Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Minor code improvements

support7e12e44b4db1
diff --git a/src/API/Grand.Api/DTOs/Common/CountryDto.cs b/src/API/Grand.Api/DTOs/Common/CountryDto.cs
index 5bb1924ab..1fb87b245 100644
--- a/src/API/Grand.Api/DTOs/Common/CountryDto.cs
+++ b/src/API/Grand.Api/DTOs/Common/CountryDto.cs
@@ -17,8 +17,8 @@ namespace Grand.Api.DTOs.Common
public int DisplayOrder { get; set; }
public virtual ICollection<StateProvinceDto> StateProvinces {
- get { return _stateProvinces ??= new List<StateProvinceDto>(); }
- protected set { _stateProvinces = value; }
+ get => _stateProvinces ??= new List<StateProvinceDto>();
+ protected set => _stateProvinces = value;
}
public class StateProvinceDto
diff --git a/src/Business/Grand.Business.Catalog/Services/Directory/GeoLookupService.cs b/src/Business/Grand.Business.Catalog/Services/Directory/GeoLookupService.cs
index 7d2eee1e8..547025679 100644
--- a/src/Business/Grand.Business.Catalog/Services/Directory/GeoLookupService.cs
+++ b/src/Business/Grand.Business.Catalog/Services/Directory/GeoLookupService.cs
@@ -67,7 +67,7 @@ namespace Grand.Business.Catalog.Services.Directory
public virtual string CountryIsoCode(string ipAddress)
{
var response = GetInformation(ipAddress);
- return response is { Country: { } } ? response.Country.IsoCode : "";
+ return response is { } ? response.Country.IsoCode : "";
}
/// <summary>
@@ -78,7 +78,7 @@ namespace Grand.Business.Catalog.Services.Directory
public virtual string CountryName(string ipAddress)
{
var response = GetInformation(ipAddress);
- return response is { Country: { } } ? response.Country.Name : "";
+ return response is { } ? response.Country.Name : "";
}
#endregion
diff --git a/src/Business/Grand.Business.Common/Services/Localization/TranslationService.cs b/src/Business/Grand.Business.Common/Services/Localization/TranslationService.cs
index 21930550e..bd00c47cf 100644
--- a/src/Business/Grand.Business.Common/Services/Localization/TranslationService.cs
+++ b/src/Business/Grand.Business.Common/Services/Localization/TranslationService.cs
@@ -252,7 +252,7 @@ namespace Grand.Business.Common.Services.Localization
var xmlDoc = LanguageXmlDocument(xml);
- var nodes = xmlDoc.SelectNodes(@"//Language/Resource");
+ var nodes = xmlDoc.SelectNodes("//Language/Resource");
if (nodes != null)
foreach (XmlNode node in nodes)
{
@@ -313,7 +313,7 @@ namespace Grand.Business.Common.Services.Localization
var translateResources = new List<TranslationResource>();
- var nodes = xmlDoc.SelectNodes(@"//Language/Resource");
+ var nodes = xmlDoc.SelectNodes("//Language/Resource");
if (nodes != null)
foreach (XmlNode node in nodes)
{
diff --git a/src/Business/Grand.Business.Common/Utilities/PowerExcelExtensions.cs b/src/Business/Grand.Business.Common/Utilities/PowerExcelExtensions.cs
index 309b6e60d..5202123ae 100644
--- a/src/Business/Grand.Business.Common/Utilities/PowerExcelExtensions.cs
+++ b/src/Business/Grand.Business.Common/Utilities/PowerExcelExtensions.cs
@@ -39,9 +39,9 @@ namespace Grand.Business.Common.Utilities
object v;
if (columnInfo.SetProp != null)
v = columnInfo.SetProp(o, val, cell);
- else if (columnInfo.IsNullable && (val == null || val is string s && s.Length == 0) && columnInfo.PropertyType == typeof(string)) //CHANGES FOR GRANDNODE
+ else if (columnInfo.IsNullable && (val == null || val is string { Length: 0 }) && columnInfo.PropertyType == typeof(string)) //CHANGES FOR GRANDNODE
v = "";
- else if (columnInfo.IsNullable && (val == null || val is string z && z.Length == 0))
+ else if (columnInfo.IsNullable && (val == null || val is string { Length: 0 }))
v = null;
else if (val is string g && columnInfo.PropertyType == typeof(Guid))
v = Guid.Parse(g);
diff --git a/src/Business/Grand.Business.Common/Utilities/PowerExcelMapper.cs b/src/Business/Grand.Business.Common/Utilities/PowerExcelMapper.cs
index 4900fe6e8..4bea34be9 100644
--- a/src/Business/Grand.Business.Common/Utilities/PowerExcelMapper.cs
+++ b/src/Business/Grand.Business.Common/Utilities/PowerExcelMapper.cs
@@ -233,7 +233,10 @@ namespace Grand.Business.Common.Utilities
return o;
}
- static object GetDefault(Type t) => t.GetTypeInfo().IsValueType ? Activator.CreateInstance(t) : null;
+ static object GetDefault(Type t)
+ {
+ return t.GetTypeInfo().IsValueType ? Activator.CreateInstance(t) : null;
+ }
readonly Dictionary<Type, Func<object>> ObjectFactories = new();
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidAskQuestion.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidAskQuestion.cs
index 3360c1297..a8009244c 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidAskQuestion.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidAskQuestion.cs
@@ -19,25 +19,13 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
AdditionalTokens = new Dictionary<string, string>();
}
- public string Email
- {
- get { return email; }
- }
+ public string Email => email;
- public string Message
- {
- get { return message; }
- }
+ public string Message => message;
- public string FullName
- {
- get { return fullName; }
- }
+ public string FullName => fullName;
- public string Phone
- {
- get { return phone; }
- }
+ public string Phone => phone;
public IDictionary<string, string> AdditionalTokens { get; set; }
}
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidAttributeCombination.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidAttributeCombination.cs
index 5de215623..b0514b793 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidAttributeCombination.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidAttributeCombination.cs
@@ -17,10 +17,7 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
public string SKU { get; set; }
- public string StockQuantity
- {
- get { return _combination.StockQuantity.ToString(); }
- }
+ public string StockQuantity => _combination.StockQuantity.ToString();
public IDictionary<string, string> AdditionalTokens { get; set; }
}
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidAuctions.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidAuctions.cs
index 85b90db15..0bed24097 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidAuctions.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidAuctions.cs
@@ -16,19 +16,13 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
AdditionalTokens = new Dictionary<string, string>();
}
- public string ProductName
- {
- get { return _product.Name; }
- }
+ public string ProductName => _product.Name;
public string Price { get; set; }
public string EndTime { get; set; }
- public string ProductSeName
- {
- get { return _product.SeName; }
- }
+ public string ProductSeName => _product.SeName;
public IDictionary<string, string> AdditionalTokens { get; set; }
}
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidBlogComment.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidBlogComment.cs
index a82648675..dd633ef35 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidBlogComment.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidBlogComment.cs
@@ -28,21 +28,11 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
AdditionalTokens = new Dictionary<string, string>();
}
- public string BlogPostTitle {
- get { return _blogPost.Title; }
- }
+ public string BlogPostTitle => _blogPost.Title;
- public string BlogPostURL {
- get {
- return $"{url}/{_blogPost.SeName}";
- }
- }
+ public string BlogPostURL => $"{url}/{_blogPost.SeName}";
- public string BlogPostCommentText {
- get {
- return _blogComment?.CommentText;
- }
- }
+ public string BlogPostCommentText => _blogComment?.CommentText;
public IDictionary<string, string> AdditionalTokens { get; set; }
}
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidContactUs.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidContactUs.cs
index c8d261e8e..dba53e65a 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidContactUs.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidContactUs.cs
@@ -19,25 +19,13 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
AdditionalTokens = new Dictionary<string, string>();
}
- public string SenderEmail
- {
- get { return senderEmail; }
- }
+ public string SenderEmail => senderEmail;
- public string SenderName
- {
- get { return senderName; }
- }
+ public string SenderName => senderName;
- public string Body
- {
- get { return body; }
- }
+ public string Body => body;
- public string AttributeDescription
- {
- get { return attributeDescription; }
- }
+ public string AttributeDescription => attributeDescription;
public IDictionary<string, string> AdditionalTokens { get; set; }
}
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidCustomer.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidCustomer.cs
index 51371009b..e7522c8a1 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidCustomer.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidCustomer.cs
@@ -25,120 +25,51 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
AdditionalTokens = new Dictionary<string, string>();
}
- public string Email
- {
- get { return _customer.Email; }
- }
+ public string Email => _customer.Email;
- public string Username
- {
- get { return _customer.Username; }
- }
+ public string Username => _customer.Username;
- public string FullName
- {
- get { return _customer.GetFullName(); }
- }
+ public string FullName => _customer.GetFullName();
- public string FirstName
- {
- get { return _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.FirstName); }
- }
+ public string FirstName => _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.FirstName);
- public string LastName
- {
- get { return _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.LastName); }
- }
+ public string LastName => _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.LastName);
- public string Gender
- {
- get { return _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.Gender); }
- }
+ public string Gender => _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.Gender);
- public string DateOfBirth
- {
- get { return _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.DateOfBirth); }
- }
+ public string DateOfBirth => _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.DateOfBirth);
- public string Company
- {
- get { return _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.Company); }
- }
+ public string Company => _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.Company);
- public string StreetAddress
- {
- get { return _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.StreetAddress); }
- }
+ public string StreetAddress => _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.StreetAddress);
- public string StreetAddress2
- {
- get { return _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.StreetAddress2); }
- }
+ public string StreetAddress2 => _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.StreetAddress2);
- public string ZipPostalCode
- {
- get { return _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.ZipPostalCode); }
- }
+ public string ZipPostalCode => _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.ZipPostalCode);
- public string City
- {
- get { return _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.City); }
- }
+ public string City => _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.City);
- public string Phone
- {
- get { return _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.Phone); }
- }
+ public string Phone => _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.Phone);
- public string Fax
- {
- get { return _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.Fax); }
- }
+ public string Fax => _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.Fax);
- public string VatNumber
- {
- get { return _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.VatNumber); }
- }
+ public string VatNumber => _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.VatNumber);
- public string VatNumberStatus
- {
- get { return ((VatNumberStatus)_customer.GetUserFieldFromEntity<int>(SystemCustomerFieldNames.VatNumberStatusId)).ToString(); }
- }
+ public string VatNumberStatus => ((VatNumberStatus)_customer.GetUserFieldFromEntity<int>(SystemCustomerFieldNames.VatNumberStatusId)).ToString();
- public string PasswordRecoveryURL
- {
- get { return string.Format("{0}/passwordrecovery/confirm?token={1}&email={2}", url, _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.PasswordRecoveryToken), WebUtility.UrlEncode(_customer.Email)); }
- }
+ public string PasswordRecoveryURL => $"{url}/passwordrecovery/confirm?token={_customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.PasswordRecoveryToken)}&email={WebUtility.UrlEncode(_customer.Email)}";
- public string AccountActivationURL
- {
- get { return string.Format("{0}/account/activation?token={1}&email={2}", url, _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.AccountActivationToken), WebUtility.UrlEncode(_customer.Email)); }
- }
+ public string AccountActivationURL => $"{url}/account/activation?token={_customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.AccountActivationToken)}&email={WebUtility.UrlEncode(_customer.Email)}";
- public string WishlistURLForCustomer
- {
- get { return string.Format("{0}/wishlist/{1}", url, _customer.CustomerGuid); }
- }
+ public string WishlistURLForCustomer => $"{url}/wishlist/{_customer.CustomerGuid}";
- public string NewNoteText
- {
- get { return FormatText.ConvertText(_customerNote.Note); }
- }
+ public string NewNoteText => FormatText.ConvertText(_customerNote.Note);
- public string NewTitleText
- {
- get { return _customerNote.Title; }
- }
+ public string NewTitleText => _customerNote.Title;
- public string CustomerNoteAttachmentUrl
- {
- get { return string.Format("{0}/download/customernotefile/{1}", url, _customerNote.Id); }
- }
+ public string CustomerNoteAttachmentUrl => $"{url}/download/customernotefile/{_customerNote.Id}";
- public string Token
- {
- get { return _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.TwoFactorValidCode); }
- }
+ public string Token => _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.TwoFactorValidCode);
public IDictionary<string, string> AdditionalTokens { get; set; }
}
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidEmail.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidEmail.cs
index 98b1f51dc..4a339c66d 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidEmail.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidEmail.cs
@@ -11,9 +11,6 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
_emailId = emailId;
}
- public string Id
- {
- get { return _emailId; }
- }
+ public string Id => _emailId;
}
}
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidEmailAFriend.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidEmailAFriend.cs
index 167611bd8..a543babcf 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidEmailAFriend.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidEmailAFriend.cs
@@ -17,19 +17,11 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
AdditionalTokens = new Dictionary<string, string>();
}
- public string PersonalMessage
- {
- get { return _personalMessage; }
- }
+ public string PersonalMessage => _personalMessage;
- public string Email
- {
- get { return _customerEmail; }
- }
+ public string Email => _customerEmail;
- public string FriendsEmail {
- get { return _friendsEmail; }
- }
+ public string FriendsEmail => _friendsEmail;
public IDictionary<string, string> AdditionalTokens { get; set; }
}
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidGiftVoucher.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidGiftVoucher.cs
index 31f0a123c..711c81872 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidGiftVoucher.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidGiftVoucher.cs
@@ -15,32 +15,17 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
AdditionalTokens = new Dictionary<string, string>();
}
- public string SenderName
- {
- get { return _giftVoucher.SenderName; }
- }
+ public string SenderName => _giftVoucher.SenderName;
- public string SenderEmail
- {
- get { return _giftVoucher.SenderEmail; }
- }
+ public string SenderEmail => _giftVoucher.SenderEmail;
- public string RecipientName
- {
- get { return _giftVoucher.RecipientName; }
- }
+ public string RecipientName => _giftVoucher.RecipientName;
- public string RecipientEmail
- {
- get { return _giftVoucher.RecipientEmail; }
- }
+ public string RecipientEmail => _giftVoucher.RecipientEmail;
public string Amount { get; set; }
- public string CouponCode
- {
- get { return _giftVoucher.Code; }
- }
+ public string CouponCode => _giftVoucher.Code;
public string Message
{
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidKnowledgebase.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidKnowledgebase.cs
index 4bca8892c..3e7d0160b 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidKnowledgebase.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidKnowledgebase.cs
@@ -28,18 +28,11 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
AdditionalTokens = new Dictionary<string, string>();
}
- public string ArticleTitle {
- get { return _article.Name; }
- }
- public string ArticleCommentText {
- get { return _articleComment.CommentText; }
- }
+ public string ArticleTitle => _article.Name;
- public string ArticleCommentUrl {
- get {
- return $"{url}/{_article.SeName}";
- }
- }
+ public string ArticleCommentText => _articleComment.CommentText;
+
+ public string ArticleCommentUrl => $"{url}/{_article.SeName}";
public IDictionary<string, string> AdditionalTokens { get; set; }
}
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidMerchandiseReturn.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidMerchandiseReturn.cs
index ded0d4fd3..b2a8dd79c 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidMerchandiseReturn.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidMerchandiseReturn.cs
@@ -32,140 +32,61 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
AdditionalTokens = new Dictionary<string, string>();
}
- public string Id
- {
- get { return _merchandiseReturn.Id; }
- }
+ public string Id => _merchandiseReturn.Id;
- public int ReturnNumber
- {
- get { return _merchandiseReturn.ReturnNumber; }
- }
+ public int ReturnNumber => _merchandiseReturn.ReturnNumber;
- public string ExternalId
- {
- get { return _merchandiseReturn.ExternalId; }
- }
+ public string ExternalId => _merchandiseReturn.ExternalId;
- public string OrderId
- {
- get { return _order.Id; }
- }
- public string OrderNumber
- {
- get { return _order.OrderNumber.ToString(); }
- }
+ public string OrderId => _order.Id;
- public string OrderCode
- {
- get { return _order.Code; }
- }
+ public string OrderNumber => _order.OrderNumber.ToString();
- public string CustomerComment
- {
- get { return FormatText.ConvertText(_merchandiseReturn.CustomerComments); }
- }
+ public string OrderCode => _order.Code;
- public string StaffNotes
- {
- get { return FormatText.ConvertText(_merchandiseReturn.StaffNotes); }
- }
+ public string CustomerComment => FormatText.ConvertText(_merchandiseReturn.CustomerComments);
+
+ public string StaffNotes => FormatText.ConvertText(_merchandiseReturn.StaffNotes);
public string Status { get; set; }
- public ICollection<LiquidMerchandiseReturnItem> Items
- {
- get
- {
- return _items;
- }
- }
+ public ICollection<LiquidMerchandiseReturnItem> Items => _items;
- public DateTime CreatedOnUtc
- {
- get { return _merchandiseReturn.CreatedOnUtc; }
- }
+ public DateTime CreatedOnUtc => _merchandiseReturn.CreatedOnUtc;
- public string PickupDate
- {
- get { return _merchandiseReturn.PickupDate.ToShortDateString(); }
- }
- public DateTime PickupDateUtc
- {
- get { return _merchandiseReturn.PickupDate; }
- }
+ public string PickupDate => _merchandiseReturn.PickupDate.ToShortDateString();
- public string PickupAddressFirstName
- {
- get { return _merchandiseReturn.PickupAddress.FirstName; }
- }
+ public DateTime PickupDateUtc => _merchandiseReturn.PickupDate;
- public string PickupAddressLastName
- {
- get { return _merchandiseReturn.PickupAddress.LastName; }
- }
+ public string PickupAddressFirstName => _merchandiseReturn.PickupAddress.FirstName;
- public string PickupAddressPhoneNumber
- {
- get { return _merchandiseReturn.PickupAddress.PhoneNumber; }
- }
+ public string PickupAddressLastName => _merchandiseReturn.PickupAddress.LastName;
- public string PickupAddressEmail
- {
- get { return _merchandiseReturn.PickupAddress.Email; }
- }
+ public string PickupAddressPhoneNumber => _merchandiseReturn.PickupAddress.PhoneNumber;
- public string PickupAddressFaxNumber
- {
- get { return _merchandiseReturn.PickupAddress.FaxNumber; }
- }
+ public string PickupAddressEmail => _merchandiseReturn.PickupAddress.Email;
- public string PickupAddressCompany
- {
- get { return _merchandiseReturn.PickupAddress.Company; }
- }
+ public string PickupAddressFaxNumber => _merchandiseReturn.PickupAddress.FaxNumber;
- public string PickupAddressVatNumber
- {
- get { return _merchandiseReturn.PickupAddress.VatNumber; }
- }
+ public string PickupAddressCompany => _merchandiseReturn.PickupAddress.Company;
- public string PickupAddressAddress1
- {
- get { return _merchandiseReturn.PickupAddress.Address1; }
- }
+ public string PickupAddressVatNumber => _merchandiseReturn.PickupAddress.VatNumber;
- public string PickupAddressAddress2
- {
- get { return _merchandiseReturn.PickupAddress.Address2; }
- }
+ public string PickupAddressAddress1 => _merchandiseReturn.PickupAddress.Address1;
- public string PickupAddressCity
- {
- get { return _merchandiseReturn.PickupAddress.City; }
- }
+ public string PickupAddressAddress2 => _merchandiseReturn.PickupAddress.Address2;
+
+ public string PickupAddressCity => _merchandiseReturn.PickupAddress.City;
public string PickupAddressStateProvince { get; set; }
- public string PickupAddressZipPostalCode
- {
- get { return _merchandiseReturn.PickupAddress.ZipPostalCode; }
- }
+ public string PickupAddressZipPostalCode => _merchandiseReturn.PickupAddress.ZipPostalCode;
public string PickupAddressCountry { get; set; }
- public string NewNoteText
- {
- get { return FormatText.ConvertText(_merchandiseReturnNote?.Note); }
- }
+ public string NewNoteText => FormatText.ConvertText(_merchandiseReturnNote?.Note);
- public string MerchandiseReturnNoteAttachmentUrl
- {
- get
- {
- return string.Format("{0}/download/merchandisereturnnotefile/{1}", url, _merchandiseReturnNote?.Id);
- }
- }
+ public string MerchandiseReturnNoteAttachmentUrl => $"{url}/download/merchandisereturnnotefile/{_merchandiseReturnNote?.Id}";
public IDictionary<string, string> AdditionalTokens { get; set; }
}
}
\ No newline at end of file
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidMerchandiseReturnItem.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidMerchandiseReturnItem.cs
index 5de09867f..f7328a753 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidMerchandiseReturnItem.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidMerchandiseReturnItem.cs
@@ -65,88 +65,33 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
}
- public string ProductId {
- get {
- return _product.Id;
- }
- }
+ public string ProductId => _product.Id;
- public int Quantity {
- get {
- return _item.Quantity;
- }
- }
+ public int Quantity => _item.Quantity;
- public string ReasonForReturn {
- get {
- return _item.ReasonForReturn;
- }
- }
+ public string ReasonForReturn => _item.ReasonForReturn;
- public string RequestedAction {
- get {
- return _item.RequestedAction;
- }
- }
- public double UnitPriceWithoutDiscInclTax {
- get {
- return _orderItem.UnitPriceWithoutDiscInclTax;
- }
- }
+ public string RequestedAction => _item.RequestedAction;
- public double UnitPriceWithoutDiscExclTax {
- get {
- return _orderItem.UnitPriceWithoutDiscExclTax;
- }
- }
+ public double UnitPriceWithoutDiscInclTax => _orderItem.UnitPriceWithoutDiscInclTax;
- public double UnitPriceInclTax {
- get {
- return _orderItem.UnitPriceInclTax;
- }
- }
+ public double UnitPriceWithoutDiscExclTax => _orderItem.UnitPriceWithoutDiscExclTax;
- public double UnitPriceExclTax {
- get {
- return _orderItem.UnitPriceExclTax;
- }
- }
+ public double UnitPriceInclTax => _orderItem.UnitPriceInclTax;
- public double PriceInclTax {
- get {
- return _orderItem.PriceInclTax;
- }
- }
+ public double UnitPriceExclTax => _orderItem.UnitPriceExclTax;
- public double PriceExclTax {
- get {
- return _orderItem.PriceExclTax;
- }
- }
+ public double PriceInclTax => _orderItem.PriceInclTax;
- public double DiscountAmountInclTax {
- get {
- return _orderItem.DiscountAmountInclTax;
- }
- }
+ public double PriceExclTax => _orderItem.PriceExclTax;
- public double DiscountAmountExclTax {
- get {
- return _orderItem.DiscountAmountExclTax;
- }
- }
+ public double DiscountAmountInclTax => _orderItem.DiscountAmountInclTax;
- public double OriginalProductCost {
- get {
- return _orderItem.OriginalProductCost;
- }
- }
+ public double DiscountAmountExclTax => _orderItem.DiscountAmountExclTax;
- public string AttributeDescription {
- get {
- return _orderItem.AttributeDescription;
- }
- }
+ public double OriginalProductCost => _orderItem.OriginalProductCost;
+
+ public string AttributeDescription => _orderItem.AttributeDescription;
public IDictionary<string, string> AdditionalTokens { get; set; }
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidNewsComment.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidNewsComment.cs
index c68b17843..f0461facf 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidNewsComment.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidNewsComment.cs
@@ -28,21 +28,13 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
AdditionalTokens = new Dictionary<string, string>();
}
- public string NewsTitle {
- get { return _newsItem.Title; }
- }
+ public string NewsTitle => _newsItem.Title;
- public string CommentText {
- get { return _newsComment.CommentText; }
- }
+ public string CommentText => _newsComment.CommentText;
- public string CommentTitle {
- get { return _newsComment.CommentTitle; }
- }
+ public string CommentTitle => _newsComment.CommentTitle;
- public string NewsURL {
- get { return $"{url}/{_newsItem.SeName}"; }
- }
+ public string NewsURL => $"{url}/{_newsItem.SeName}";
public IDictionary<string, string> AdditionalTokens { get; set; }
}
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidNewsLetterSubscription.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidNewsLetterSubscription.cs
index 9cdb69cfc..5868e3c35 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidNewsLetterSubscription.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidNewsLetterSubscription.cs
@@ -23,10 +23,7 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
AdditionalTokens = new Dictionary<string, string>();
}
- public string Email
- {
- get { return _subscription.Email; }
- }
+ public string Email => _subscription.Email;
public string ActivationUrl
{
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidOrder.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidOrder.cs
index 7a4594a70..9fb87ae7f 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidOrder.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidOrder.cs
@@ -44,156 +44,71 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
AdditionalTokens = new Dictionary<string, string>();
}
- public string OrderNumber
- {
- get { return _order.OrderNumber.ToString(); }
- }
+ public string OrderNumber => _order.OrderNumber.ToString();
- public string OrderCode
- {
- get { return _order.Code; }
- }
+ public string OrderCode => _order.Code;
- public string CustomerFullName
- {
- get { return string.Format("{0} {1}", _order.BillingAddress.FirstName, _order.BillingAddress.LastName); }
- }
+ public string CustomerFullName => $"{_order.BillingAddress.FirstName} {_order.BillingAddress.LastName}";
- public string CustomerEmail
- {
- get { return _order.BillingAddress.Email; }
- }
+ public string CustomerEmail => _order.BillingAddress.Email;
- public string BillingAddressName {
- get { return _order.BillingAddress.Name; }
- }
+ public string BillingAddressName => _order.BillingAddress.Name;
- public string BillingFirstName
- {
- get { return _order.BillingAddress.FirstName; }
- }
+ public string BillingFirstName => _order.BillingAddress.FirstName;
- public string BillingLastName
- {
- get { return _order.BillingAddress.LastName; }
- }
+ public string BillingLastName => _order.BillingAddress.LastName;
- public string BillingPhoneNumber
- {
- get { return _order.BillingAddress.PhoneNumber; }
- }
+ public string BillingPhoneNumber => _order.BillingAddress.PhoneNumber;
- public string BillingEmail
- {
- get { return _order.BillingAddress.Email; }
- }
+ public string BillingEmail => _order.BillingAddress.Email;
- public string BillingFaxNumber
- {
- get { return _order.BillingAddress.FaxNumber; }
- }
+ public string BillingFaxNumber => _order.BillingAddress.FaxNumber;
- public string BillingCompany
- {
- get { return _order.BillingAddress.Company; }
- }
+ public string BillingCompany => _order.BillingAddress.Company;
- public string BillingVatNumber
- {
- get { return _order.BillingAddress.VatNumber; }
- }
+ public string BillingVatNumber => _order.BillingAddress.VatNumber;
- public string BillingAddress1
- {
- get { return _order.BillingAddress.Address1; }
- }
+ public string BillingAddress1 => _order.BillingAddress.Address1;
- public string BillingAddress2
- {
- get { return _order.BillingAddress.Address2; }
- }
+ public string BillingAddress2 => _order.BillingAddress.Address2;
- public string BillingCity
- {
- get { return _order.BillingAddress.City; }
- }
+ public string BillingCity => _order.BillingAddress.City;
public string BillingStateProvince { get; set; }
- public string BillingZipPostalCode
- {
- get { return _order.BillingAddress.ZipPostalCode; }
- }
+ public string BillingZipPostalCode => _order.BillingAddress.ZipPostalCode;
public string BillingCountry { get; set; }
public string BillingCustomAttributes { get; set; }
- public string ShippingMethod
- {
- get { return _order.ShippingMethod; }
- }
+ public string ShippingMethod => _order.ShippingMethod;
- public string ShippingAdditionDescription
- {
- get { return _order.ShippingOptionAttributeDescription; }
- }
+ public string ShippingAdditionDescription => _order.ShippingOptionAttributeDescription;
- public string ShippingAddressName {
- get { return _order.ShippingAddress != null ? _order.ShippingAddress.Name : ""; }
- }
+ public string ShippingAddressName => _order.ShippingAddress != null ? _order.ShippingAddress.Name : "";
- public string ShippingFirstName
- {
- get { return _order.ShippingAddress != null ? _order.ShippingAddress.FirstName : ""; }
- }
+ public string ShippingFirstName => _order.ShippingAddress != null ? _order.ShippingAddress.FirstName : "";
- public string ShippingLastName
- {
- get { return _order.ShippingAddress != null ? _order.ShippingAddress.LastName : ""; }
- }
+ public string ShippingLastName => _order.ShippingAddress != null ? _order.ShippingAddress.LastName : "";
- public string ShippingPhoneNumber
- {
- get { return _order.ShippingAddress != null ? _order.ShippingAddress.PhoneNumber : ""; }
- }
+ public string ShippingPhoneNumber => _order.ShippingAddress != null ? _order.ShippingAddress.PhoneNumber : "";
- public string ShippingEmail
- {
- get { return _order.ShippingAddress != null ? _order.ShippingAddress.Email : ""; }
- }
+ public string ShippingEmail => _order.ShippingAddress != null ? _order.ShippingAddress.Email : "";
- public string ShippingFaxNumber
- {
- get { return _order.ShippingAddress != null ? _order.ShippingAddress.FaxNumber : ""; }
- }
+ public string ShippingFaxNumber => _order.ShippingAddress != null ? _order.ShippingAddress.FaxNumber : "";
- public string ShippingCompany
- {
- get { return _order.ShippingAddress != null ? _order.ShippingAddress.Company : ""; }
- }
+ public string ShippingCompany => _order.ShippingAddress != null ? _order.ShippingAddress.Company : "";
- public string ShippingAddress1
- {
- get { return _order.ShippingAddress != null ? _order.ShippingAddress.Address1 : ""; }
- }
+ public string ShippingAddress1 => _order.ShippingAddress != null ? _order.ShippingAddress.Address1 : "";
- public string ShippingAddress2
- {
- get { return _order.ShippingAddress != null ? _order.ShippingAddress.Address2 : ""; }
- }
+ public string ShippingAddress2 => _order.ShippingAddress != null ? _order.ShippingAddress.Address2 : "";
- public string ShippingCity
- {
- get { return _order.ShippingAddress != null ? _order.ShippingAddress.City : ""; }
- }
+ public string ShippingCity => _order.ShippingAddress != null ? _order.ShippingAddress.City : "";
public string ShippingStateProvince { get; set; }
- public string ShippingZipPostalCode
- {
- get { return _order.ShippingAddress != null ? _order.ShippingAddress.ZipPostalCode : ""; }
- }
+ public string ShippingZipPostalCode => _order.ShippingAddress != null ? _order.ShippingAddress.ZipPostalCode : "";
public string ShippingCountry { get; set; }
@@ -202,74 +117,27 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
public string PaymentMethod { get; set; }
- public string VatNumber
- {
- get { return _order.VatNumber; }
- }
+ public string VatNumber => _order.VatNumber;
- public string CreatedOn
- {
- get
- {
- return _order.CreatedOnUtc.ToLocalTime().ToString("D");
- }
- }
+ public string CreatedOn => _order.CreatedOnUtc.ToLocalTime().ToString("D");
- public DateTime CreatedOnUtc
- {
- get
- {
- return _order.CreatedOnUtc;
- }
- }
+ public DateTime CreatedOnUtc => _order.CreatedOnUtc;
- public string OrderURLForCustomer
- {
- get { return string.Format("{0}/orderdetails/{1}", url, _order.Id); }
- }
+ public string OrderURLForCustomer => $"{url}/orderdetails/{_order.Id}";
- public double PaidAmount {
- get {
- return _order.PaidAmount;
- }
- }
+ public double PaidAmount => _order.PaidAmount;
- public double RefundedAmount {
- get {
- return _order.RefundedAmount;
- }
- }
+ public double RefundedAmount => _order.RefundedAmount;
- public string NewNoteText
- {
- get { return FormatText.ConvertText(_orderNote.Note); }
- }
+ public string NewNoteText => FormatText.ConvertText(_orderNote.Note);
- public string OrderNoteAttachmentUrl
- {
- get
- {
- return string.Format("{0}/download/ordernotefile/{1}", url, _orderNote.Id);
- }
- }
+ public string OrderNoteAttachmentUrl => $"{url}/download/ordernotefile/{_orderNote.Id}";
- public string VendorName
- {
- get { return _vendor?.Name; }
- }
+ public string VendorName => _vendor?.Name;
- public string VendorEmail
- {
- get { return _vendor?.Email; }
- }
+ public string VendorEmail => _vendor?.Email;
- public ICollection<LiquidOrderItem> OrderItems
- {
- get
- {
- return _orderItems;
- }
- }
+ public ICollection<LiquidOrderItem> OrderItems => _orderItems;
public bool DisplaySubTotalDiscount { get; set; }
@@ -283,20 +151,9 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
public string Total { get; set; }
- public bool DisplayShipping
- {
- get
- {
- return _order.ShippingStatusId != ShippingStatus.ShippingNotRequired;
- }
- }
- public bool DisplayPaymentMethodFee
- {
- get
- {
- return _order.PaymentMethodAdditionalFeeExclTax > 0;
- }
- }
+ public bool DisplayShipping => _order.ShippingStatusId != ShippingStatus.ShippingNotRequired;
+
+ public bool DisplayPaymentMethodFee => _order.PaymentMethodAdditionalFeeExclTax > 0;
public string PaymentMethodAdditionalFee { get; set; }
@@ -310,50 +167,22 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
public string Discount { get; set; }
- public string CheckoutAttributeDescription
- {
- get
- {
- return _order.CheckoutAttributeDescription;
- }
- }
+ public string CheckoutAttributeDescription => _order.CheckoutAttributeDescription;
public Dictionary<string, string> GiftVouchers { get; set; }
- public bool RedeemedLoyaltyPointsEntryExists
- {
- get
- {
- return _order.RedeemedLoyaltyPoints > 0;
- }
- }
+ public bool RedeemedLoyaltyPointsEntryExists => _order.RedeemedLoyaltyPoints > 0;
public string RPAmount { get; set; }
public string RPPoints { get; set; }
- public bool IsRecurring {
- get {
- return _order.IsRecurring;
- }
- }
+ public bool IsRecurring => _order.IsRecurring;
- public int RecurringCycleLength {
- get {
- return _order.RecurringCycleLength;
- }
- }
+ public int RecurringCycleLength => _order.RecurringCycleLength;
- public int RecurringCyclePeriodId {
- get {
- return (int)_order.RecurringCyclePeriodId;
- }
- }
+ public int RecurringCyclePeriodId => (int)_order.RecurringCyclePeriodId;
- public int RecurringTotalCycles {
- get {
- return _order.RecurringTotalCycles;
- }
- }
+ public int RecurringTotalCycles => _order.RecurringTotalCycles;
public IDictionary<string, string> AdditionalTokens { get; set; }
}
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidOrderItem.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidOrderItem.cs
index cefffac31..e2e7ee515 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidOrderItem.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidOrderItem.cs
@@ -48,23 +48,19 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
public string DownloadUrl {
get {
- var downloadUrl = string.Format("{0}/download/getdownload/{1}", url, _orderItem.OrderItemGuid);
+ var downloadUrl = $"{url}/download/getdownload/{_orderItem.OrderItemGuid}";
return downloadUrl;
}
}
public string LicenseUrl {
get {
- var licenseUrl = string.Format("{0}/download/getlicense/{1}", url, _orderItem.OrderItemGuid);
+ var licenseUrl = $"{url}/download/getlicense/{_orderItem.OrderItemGuid}";
return licenseUrl;
}
}
- public Guid OrderItemGuid {
- get {
- return _orderItem.OrderItemGuid;
- }
- }
+ public Guid OrderItemGuid => _orderItem.OrderItemGuid;
public string ProductName {
get {
@@ -108,188 +104,71 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
}
}
- public string ProductId {
- get {
- return _orderItem.ProductId;
- }
- }
+ public string ProductId => _orderItem.ProductId;
- public string VendorId {
- get {
- return _orderItem.VendorId;
- }
- }
+ public string VendorId => _orderItem.VendorId;
- public string VendorName {
- get {
- return _vendor?.Name;
- }
- }
+ public string VendorName => _vendor?.Name;
- public string WarehouseId {
- get {
- return _orderItem.WarehouseId;
- }
- }
+ public string WarehouseId => _orderItem.WarehouseId;
- public int Quantity {
- get {
- return _orderItem.Quantity;
- }
- }
+ public int Quantity => _orderItem.Quantity;
- public int OpenQty {
- get {
- return _orderItem.OpenQty;
- }
- }
+ public int OpenQty => _orderItem.OpenQty;
- public int CancelQty {
- get {
- return _orderItem.CancelQty;
- }
- }
- public int ShipQty {
- get {
- return _orderItem.ShipQty;
- }
- }
+ public int CancelQty => _orderItem.CancelQty;
- public bool IsShipEnabled {
- get {
- return _orderItem.IsShipEnabled;
- }
- }
+ public int ShipQty => _orderItem.ShipQty;
- public double UnitPriceWithoutDiscInclTax {
- get {
- return _orderItem.UnitPriceWithoutDiscInclTax;
- }
- }
+ public bool IsShipEnabled => _orderItem.IsShipEnabled;
- public double UnitPriceWithoutDiscExclTax {
- get {
- return _orderItem.UnitPriceWithoutDiscExclTax;
- }
- }
+ public double UnitPriceWithoutDiscInclTax => _orderItem.UnitPriceWithoutDiscInclTax;
- public double UnitPriceInclTax {
- get {
- return _orderItem.UnitPriceInclTax;
- }
- }
+ public double UnitPriceWithoutDiscExclTax => _orderItem.UnitPriceWithoutDiscExclTax;
- public double UnitPriceExclTax {
- get {
- return _orderItem.UnitPriceExclTax;
- }
- }
+ public double UnitPriceInclTax => _orderItem.UnitPriceInclTax;
- public double PriceInclTax {
- get {
- return _orderItem.PriceInclTax;
- }
- }
+ public double UnitPriceExclTax => _orderItem.UnitPriceExclTax;
- public double PriceExclTax {
- get {
- return _orderItem.PriceExclTax;
- }
- }
+ public double PriceInclTax => _orderItem.PriceInclTax;
- public double DiscountAmountInclTax {
- get {
- return _orderItem.DiscountAmountInclTax;
- }
- }
+ public double PriceExclTax => _orderItem.PriceExclTax;
- public double DiscountAmountExclTax {
- get {
- return _orderItem.DiscountAmountExclTax;
- }
- }
+ public double DiscountAmountInclTax => _orderItem.DiscountAmountInclTax;
- public double OriginalProductCost {
- get {
- return _orderItem.OriginalProductCost;
- }
- }
+ public double DiscountAmountExclTax => _orderItem.DiscountAmountExclTax;
- public string AttributeDescription {
- get {
- return _orderItem.AttributeDescription;
- }
- }
+ public double OriginalProductCost => _orderItem.OriginalProductCost;
- public int DownloadCount {
- get {
- return _orderItem.DownloadCount;
- }
- }
+ public string AttributeDescription => _orderItem.AttributeDescription;
- public bool IsDownloadActivated {
- get {
- return _orderItem.IsDownloadActivated;
- }
- }
+ public int DownloadCount => _orderItem.DownloadCount;
- public string LicenseDownloadId {
- get {
- return _orderItem.LicenseDownloadId;
- }
- }
+ public bool IsDownloadActivated => _orderItem.IsDownloadActivated;
- public double? ItemWeight {
- get {
- return _orderItem.ItemWeight;
- }
- }
+ public string LicenseDownloadId => _orderItem.LicenseDownloadId;
- public double ProductWeight {
- get { return _product.Weight; }
- }
+ public double? ItemWeight => _orderItem.ItemWeight;
- public double ProductLength {
- get { return _product.Length; }
- }
+ public double ProductWeight => _product.Weight;
- public double ProductWidth {
- get { return _product.Width; }
- }
+ public double ProductLength => _product.Length;
- public double ProductHeight {
- get { return _product.Height; }
- }
+ public double ProductWidth => _product.Width;
- public double ProductCatalogPrice {
- get { return _product.CatalogPrice; }
- }
+ public double ProductHeight => _product.Height;
- public double ProductOldPrice {
- get { return _product.OldPrice; }
- }
+ public double ProductCatalogPrice => _product.CatalogPrice;
- public string ProductFlag {
- get { return _product.Flag; }
- }
+ public double ProductOldPrice => _product.OldPrice;
- public DateTime? RentalStartDateUtc {
- get {
- return _orderItem.RentalStartDateUtc;
- }
- }
+ public string ProductFlag => _product.Flag;
- public DateTime? RentalEndDateUtc {
- get {
- return _orderItem.RentalEndDateUtc;
- }
- }
+ public DateTime? RentalStartDateUtc => _orderItem.RentalStartDateUtc;
- public DateTime CreatedOnUtc {
- get {
- return _orderItem.CreatedOnUtc;
- }
- }
+ public DateTime? RentalEndDateUtc => _orderItem.RentalEndDateUtc;
+
+ public DateTime CreatedOnUtc => _orderItem.CreatedOnUtc;
public IDictionary<string, string> AdditionalTokens { get; set; }
}
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidOutOfStockSubscription.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidOutOfStockSubscription.cs
index 96c1c65fb..8fcc1e64b 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidOutOfStockSubscription.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidOutOfStockSubscription.cs
@@ -27,17 +27,11 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
AdditionalTokens = new Dictionary<string, string>();
}
- public string ProductName {
- get { return _product.Name; }
- }
+ public string ProductName => _product.Name;
- public string AttributeInfo {
- get { return _outOfStockSubscription.AttributeInfo; }
- }
+ public string AttributeInfo => _outOfStockSubscription.AttributeInfo;
- public string ProductUrl {
- get { return string.Format("{0}/{1}", url, _product.SeName); }
- }
+ public string ProductUrl => $"{url}/{_product.SeName}";
public IDictionary<string, string> AdditionalTokens { get; set; }
}
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidProduct.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidProduct.cs
index b89d02b1d..7978be4fd 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidProduct.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidProduct.cs
@@ -25,79 +25,42 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
AdditionalTokens = new Dictionary<string, string>();
}
- public string Id {
- get { return _product.Id; }
- }
+ public string Id => _product.Id;
- public string Name {
- get { return _product.GetTranslation(x => x.Name, _language.Id); }
- }
+ public string Name => _product.GetTranslation(x => x.Name, _language.Id);
- public string ShortDescription {
- get { return _product.GetTranslation(x => x.ShortDescription, _language.Id); }
- }
+ public string ShortDescription => _product.GetTranslation(x => x.ShortDescription, _language.Id);
- public string SKU {
- get { return _product.Sku; }
- }
+ public string SKU => _product.Sku;
- public string ExternalId {
- get { return _product.ExternalId; }
- }
+ public string ExternalId => _product.ExternalId;
- public string Mpn {
- get { return _product.Mpn; }
- }
+ public string Mpn => _product.Mpn;
- public string Gtin {
- get { return _product.Gtin; }
- }
+ public string Gtin => _product.Gtin;
- public double AdditionalShippingCharge {
- get { return _product.AdditionalShippingCharge; }
- }
+ public double AdditionalShippingCharge => _product.AdditionalShippingCharge;
- public int StockQuantity {
- get { return _product.StockQuantity; }
- }
+ public int StockQuantity => _product.StockQuantity;
+ public double Price => _product.Price;
- public double Price {
- get { return _product.Price; }
- }
+ public double CatalogPrice => _product.CatalogPrice;
- public double CatalogPrice {
- get { return _product.CatalogPrice; }
- }
+ public double OldPrice => _product.OldPrice;
- public double OldPrice {
- get { return _product.OldPrice; }
- }
+ public string Flag => _product.Flag;
- public string Flag {
- get { return _product.Flag; }
- }
+ public string ProductURLForCustomer => $"{url}/{_product.GetSeName(_language.Id)}";
- public string ProductURLForCustomer {
- get { return string.Format("{0}/{1}", url, _product.GetSeName(_language.Id)); }
- }
+ public double Weight => _product.Weight;
- public double Weight {
- get { return _product.Weight; }
- }
+ public double Length => _product.Length;
- public double Length {
- get { return _product.Length; }
- }
-
- public double Width {
- get { return _product.Width; }
- }
+ public double Width => _product.Width;
- public double Height {
- get { return _product.Height; }
- }
+ public double Height => _product.Height;
public IDictionary<string, string> AdditionalTokens { get; set; }
}
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidProductReview.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidProductReview.cs
index 3b12546e4..f999bde74 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidProductReview.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidProductReview.cs
@@ -15,19 +15,9 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
AdditionalTokens = new Dictionary<string, string>();
}
- public string ProductName
- {
- get
- {
- return _product.Name;
- }
- }
+ public string ProductName => _product.Name;
- public string ProductReviewReplyText {
- get {
- return _productReview.ReplyText;
- }
- }
+ public string ProductReviewReplyText => _productReview.ReplyText;
public IDictionary<string, string> AdditionalTokens { get; set; }
}
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidShipment.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidShipment.cs
index 7ce37edd1..11a0beb23 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidShipment.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidShipment.cs
@@ -31,44 +31,21 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
AdditionalTokens = new Dictionary<string, string>();
}
- public ICollection<LiquidShipmentItem> ShipmentItems
- {
- get { return _shipmentItems; }
- }
+ public ICollection<LiquidShipmentItem> ShipmentItems => _shipmentItems;
- public string ShipmentNumber
- {
- get { return _shipment.ShipmentNumber.ToString(); }
- }
+ public string ShipmentNumber => _shipment.ShipmentNumber.ToString();
- public string TrackingNumber
- {
- get { return _shipment.TrackingNumber; }
- }
+ public string TrackingNumber => _shipment.TrackingNumber;
- public DateTime? ShippedDateUtc {
- get { return _shipment.ShippedDateUtc; }
- }
+ public DateTime? ShippedDateUtc => _shipment.ShippedDateUtc;
- public DateTime? DeliveryDateUtc {
- get { return _shipment.DeliveryDateUtc; }
- }
- public DateTime CreatedOnUtc {
- get { return _shipment.CreatedOnUtc; }
- }
+ public DateTime? DeliveryDateUtc => _shipment.DeliveryDateUtc;
- public string AdminComment
- {
- get { return _shipment.AdminComment; }
- }
+ public DateTime CreatedOnUtc => _shipment.CreatedOnUtc;
- public string URLForCustomer
- {
- get
- {
- return string.Format("{0}/orderdetails/shipment/{1}", url, _shipment.Id);
- }
- }
+ public string AdminComment => _shipment.AdminComment;
+
+ public string URLForCustomer => $"{url}/orderdetails/shipment/{_shipment.Id}";
public IDictionary<string, string> AdditionalTokens { get; set; }
}
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidShipmentItem.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidShipmentItem.cs
index 47e1508c5..286a9efde 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidShipmentItem.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidShipmentItem.cs
@@ -40,11 +40,7 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
}
}
- public string ProductSku {
- get {
- return _orderItem.Sku;
- }
- }
+ public string ProductSku => _orderItem.Sku;
public string AttributeDescription {
get {
@@ -57,35 +53,15 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
}
}
- public string ShipmentId {
- get {
- return _shipment.Id;
- }
- }
+ public string ShipmentId => _shipment.Id;
- public string OrderItemId {
- get {
- return _shipmentItem.OrderItemId;
- }
- }
+ public string OrderItemId => _shipmentItem.OrderItemId;
- public string ProductId {
- get {
- return _shipmentItem.ProductId;
- }
- }
+ public string ProductId => _shipmentItem.ProductId;
- public int Quantity {
- get {
- return _shipmentItem.Quantity;
- }
- }
+ public int Quantity => _shipmentItem.Quantity;
- public string WarehouseId {
- get {
- return _shipmentItem.WarehouseId;
- }
- }
+ public string WarehouseId => _shipmentItem.WarehouseId;
public IDictionary<string, string> AdditionalTokens { get; set; }
}
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidShoppingCart.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidShoppingCart.cs
index 9ebb1d86e..9c638e6e7 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidShoppingCart.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidShoppingCart.cs
@@ -15,37 +15,17 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
_items = new List<LiquidShoppingCartItem>();
AdditionalTokens = new Dictionary<string, string>();
}
- public string Email
- {
- get { return _customer.Email; }
- }
+ public string Email => _customer.Email;
- public string Username
- {
- get { return _customer.Username; }
- }
+ public string Username => _customer.Username;
- public string FullName
- {
- get { return _customer.GetFullName(); }
- }
+ public string FullName => _customer.GetFullName();
- public string FirstName
- {
- get { return _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.FirstName); }
- }
+ public string FirstName => _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.FirstName);
- public string LastName
- {
- get { return _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.LastName); }
- }
- public ICollection<LiquidShoppingCartItem> Items
- {
- get
- {
- return _items;
- }
- }
+ public string LastName => _customer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.LastName);
+
+ public ICollection<LiquidShoppingCartItem> Items => _items;
public IDictionary<string, string> AdditionalTokens { get; set; }
}
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidShoppingCartItem.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidShoppingCartItem.cs
index 68c62a489..f3613960a 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidShoppingCartItem.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidShoppingCartItem.cs
@@ -29,36 +29,13 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
AdditionalTokens = new Dictionary<string, string>();
}
- public string AttributeDescription
- {
- get
- {
- return _attributeDescription;
- }
- }
+ public string AttributeDescription => _attributeDescription;
- public string PictureUrl
- {
- get
- {
- return _pictureUrl;
- }
- }
+ public string PictureUrl => _pictureUrl;
- public int Quantity
- {
- get
- {
- return _shoppingCartItem.Quantity;
- }
- }
- public ShoppingCartType ShoppingCartType
- {
- get
- {
- return _shoppingCartItem.ShoppingCartTypeId;
- }
- }
+ public int Quantity => _shoppingCartItem.Quantity;
+
+ public ShoppingCartType ShoppingCartType => _shoppingCartItem.ShoppingCartTypeId;
public string ProductName
{
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidStore.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidStore.cs
index b4df7e0b1..6ce81b2af 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidStore.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidStore.cs
@@ -20,62 +20,35 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
AdditionalTokens = new Dictionary<string, string>();
}
- public string Name {
- get { return _store.Name; }
- }
+ public string Name => _store.Name;
- public string Shortcut {
- get { return _store.Shortcut; }
- }
+ public string Shortcut => _store.Shortcut;
- public string URL {
- get { return _store.SslEnabled ? _store.SecureUrl : _store.Url; }
- }
+ public string URL => _store.SslEnabled ? _store.SecureUrl : _store.Url;
- public string Email {
- get { return _emailAccount.Email; }
- }
+ public string Email => _emailAccount.Email;
- public string CompanyName {
- get { return _store.CompanyName; }
- }
+ public string CompanyName => _store.CompanyName;
- public string CompanyAddress {
- get { return _store.CompanyAddress; }
- }
+ public string CompanyAddress => _store.CompanyAddress;
- public string CompanyPhoneNumber {
- get { return _store.CompanyPhoneNumber; }
- }
+ public string CompanyPhoneNumber => _store.CompanyPhoneNumber;
- public string CompanyEmail {
- get { return _store.CompanyEmail; }
- }
+ public string CompanyEmail => _store.CompanyEmail;
- public string CompanyHours {
- get { return _store.CompanyHours; }
- }
+ public string CompanyHours => _store.CompanyHours;
- public string CompanyRegNo {
- get { return _store.CompanyRegNo; }
- }
+ public string CompanyRegNo => _store.CompanyRegNo;
- public string CompanyVat {
- get { return _store.CompanyVat; }
- }
+ public string CompanyVat => _store.CompanyVat;
- public string BankCode {
- get { return _store.BankAccount?.BankCode; }
- }
- public string BankName {
- get { return _store.BankAccount?.BankName; }
- }
- public string SwiftCode {
- get { return _store.BankAccount?.SwiftCode; }
- }
- public string AccountNumber {
- get { return _store.BankAccount?.AccountNumber; }
- }
+ public string BankCode => _store.BankAccount?.BankCode;
+
+ public string BankName => _store.BankAccount?.BankName;
+
+ public string SwiftCode => _store.BankAccount?.SwiftCode;
+
+ public string AccountNumber => _store.BankAccount?.AccountNumber;
public string TwitterLink { get; set; }
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidVatValidationResult.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidVatValidationResult.cs
index fc74fd262..4f6837597 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidVatValidationResult.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidVatValidationResult.cs
@@ -15,15 +15,9 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
AdditionalTokens = new Dictionary<string, string>();
}
- public string Name
- {
- get { return name; }
- }
+ public string Name => name;
- public string Address
- {
- get { return address; }
- }
+ public string Address => address;
public IDictionary<string, string> AdditionalTokens { get; set; }
}
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidVendor.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidVendor.cs
index d37e7d204..99a63d18b 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidVendor.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidVendor.cs
@@ -13,55 +13,25 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
AdditionalTokens = new Dictionary<string, string>();
}
- public string Name
- {
- get { return _vendor.Name; }
- }
+ public string Name => _vendor.Name;
- public string Email
- {
- get { return _vendor.Email; }
- }
+ public string Email => _vendor.Email;
- public string Description
- {
- get { return _vendor.Description; }
- }
+ public string Description => _vendor.Description;
- public string Address1
- {
- get { return _vendor.Address?.Address1; }
- }
+ public string Address1 => _vendor.Address?.Address1;
- public string Address2
- {
- get { return _vendor.Address?.Address2; }
- }
+ public string Address2 => _vendor.Address?.Address2;
- public string City
- {
- get { return _vendor.Address?.City; }
- }
+ public string City => _vendor.Address?.City;
- public string Company
- {
- get { return _vendor.Address?.Company; }
- }
+ public string Company => _vendor.Address?.Company;
- public string FaxNumber
- {
- get { return _vendor.Address?.FaxNumber; }
- }
+ public string FaxNumber => _vendor.Address?.FaxNumber;
- public string PhoneNumber
- {
- get { return _vendor.Address?.PhoneNumber; }
- }
+ public string PhoneNumber => _vendor.Address?.PhoneNumber;
- public string ZipPostalCode
- {
- get { return _vendor.Address?.ZipPostalCode; }
- }
+ public string ZipPostalCode => _vendor.Address?.ZipPostalCode;
public string StateProvince { get; set; }
diff --git a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidVendorReview.cs b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidVendorReview.cs
index cc3a92126..79c86069c 100644
--- a/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidVendorReview.cs
+++ b/src/Business/Grand.Business.Core/Utilities/Messages/DotLiquidDrops/LiquidVendorReview.cs
@@ -15,19 +15,11 @@ namespace Grand.Business.Core.Utilities.Messages.DotLiquidDrops
AdditionalTokens = new Dictionary<string, string>();
}
- public string VendorName
- {
- get { return _vendor.Name; }
- }
+ public string VendorName => _vendor.Name;
- public string Title
- {
- get { return _vendorReview.Title; }
- }
- public string ReviewText
- {
- get { return _vendorReview.ReviewText; }
- }
+ public string Title => _vendorReview.Title;
+
+ public string ReviewText => _vendorReview.ReviewText;
public IDictionary<string, string> AdditionalTokens { get; set; }
}
diff --git a/src/Business/Grand.Business.Storage/Services/FileSystemStore.cs b/src/Business/Grand.Business.Storage/Services/FileSystemStore.cs
index 6bd1e731f..0412b1072 100644
--- a/src/Business/Grand.Business.Storage/Services/FileSystemStore.cs
+++ b/src/Business/Grand.Business.Storage/Services/FileSystemStore.cs
@@ -265,7 +265,7 @@ namespace Grand.Business.Storage.Services
if (!File.Exists(physicalPath))
{
- throw new Exception($"File not exists.");
+ throw new Exception("File not exists.");
}
return File.ReadAllTextAsync(physicalPath);
}
diff --git a/src/Business/Grand.Business.Storage/Services/FileSystemStoreEntry.cs b/src/Business/Grand.Business.Storage/Services/FileSystemStoreEntry.cs
index 55e59221f..869bb7b41 100644
--- a/src/Business/Grand.Business.Storage/Services/FileSystemStoreEntry.cs
+++ b/src/Business/Grand.Business.Storage/Services/FileSystemStoreEntry.cs
@@ -17,7 +17,7 @@ namespace Grand.Business.Storage.Services
public string Path => _path;
public string Name => _fileInfo.Name;
- public string DirectoryPath => _path[0..^Name.Length].TrimEnd('/');
+ public string DirectoryPath => _path[..^Name.Length].TrimEnd('/');
public string PhysicalPath => _fileInfo.PhysicalPath;
public DateTime LastModifiedUtc => _fileInfo.LastModified.UtcDateTime;
public long Length => _fileInfo.Length;
diff --git a/src/Business/Grand.Business.System/Commands/Handlers/Common/GetSitemapXMLCommandHandler.cs b/src/Business/Grand.Business.System/Commands/Handlers/Common/GetSitemapXMLCommandHandler.cs
index d25021284..3aff023c6 100644
--- a/src/Business/Grand.Business.System/Commands/Handlers/Common/GetSitemapXMLCommandHandler.cs
+++ b/src/Business/Grand.Business.System/Commands/Handlers/Common/GetSitemapXMLCommandHandler.cs
@@ -23,7 +23,7 @@ namespace Grand.Business.System.Commands.Handlers.Common
{
public class GetSitemapXMLCommandHandler : IRequestHandler<GetSitemapXmlCommand, string>
{
- private const string DateFormat = @"yyyy-MM-dd";
+ private const string DateFormat = "yyyy-MM-dd";
private readonly ICategoryService _categoryService;
private readonly IProductService _productService;
@@ -248,7 +248,7 @@ namespace Grand.Business.System.Commands.Handlers.Common
imageurl = await _pictureService.GetPictureUrl(category.PictureId, showDefaultPicture: false, storeLocation: storeLocation);
}
}
- categories.Add(new SitemapUrl(url, imageurl, UpdateFrequency.Weekly, category.UpdatedOnUtc.HasValue ? category.UpdatedOnUtc.Value : category.CreatedOnUtc));
+ categories.Add(new SitemapUrl(url, imageurl, UpdateFrequency.Weekly, category.UpdatedOnUtc ?? category.CreatedOnUtc));
categories.AddRange(await GetCategoryUrls(category.Id, language));
}
return categories;
@@ -275,7 +275,7 @@ namespace Grand.Business.System.Commands.Handlers.Common
imageUrl = await _pictureService.GetPictureUrl(brand.PictureId, showDefaultPicture: false, storeLocation: storeLocation);
}
}
- brandUrls.Add(new SitemapUrl(url, imageUrl, UpdateFrequency.Weekly, brand.UpdatedOnUtc.HasValue ? brand.UpdatedOnUtc.Value : brand.CreatedOnUtc));
+ brandUrls.Add(new SitemapUrl(url, imageUrl, UpdateFrequency.Weekly, brand.UpdatedOnUtc ?? brand.CreatedOnUtc));
}
return brandUrls;
}
@@ -302,7 +302,7 @@ namespace Grand.Business.System.Commands.Handlers.Common
imageUrl = await _pictureService.GetPictureUrl(product.ProductPictures.FirstOrDefault()?.PictureId, showDefaultPicture: false, storeLocation: storeLocation);
}
}
- products.Add(new SitemapUrl(url, imageUrl, UpdateFrequency.Weekly, product.UpdatedOnUtc.HasValue ? product.UpdatedOnUtc.Value : product.CreatedOnUtc));
+ products.Add(new SitemapUrl(url, imageUrl, UpdateFrequency.Weekly, product.UpdatedOnUtc ?? product.CreatedOnUtc));
}
return products;
diff --git a/src/Business/Grand.Business.System/Services/Installation/InstallDataCurrencies.cs b/src/Business/Grand.Business.System/Services/Installation/InstallDataCurrencies.cs
index bf8bb9747..e1f0c3843 100644
--- a/src/Business/Grand.Business.System/Services/Installation/InstallDataCurrencies.cs
+++ b/src/Business/Grand.Business.System/Services/Installation/InstallDataCurrencies.cs
@@ -27,7 +27,7 @@ namespace Grand.Business.System.Services.Installation
CurrencyCode = "EUR",
Rate = 0.95,
DisplayLocale = "",
- CustomFormatting = string.Format("{0}0.00", "\u20ac"),
+ CustomFormatting = $"{"\u20ac"}0.00",
NumberDecimal = 2,
Published = true,
DisplayOrder = 2,
diff --git a/src/Business/Grand.Business.System/Services/Installation/InstallDataProducts.cs b/src/Business/Grand.Business.System/Services/Installation/InstallDataProducts.cs
index 3ef75afc6..ae286af8a 100644
--- a/src/Business/Grand.Business.System/Services/Installation/InstallDataProducts.cs
+++ b/src/Business/Grand.Business.System/Services/Installation/InstallDataProducts.cs
@@ -3643,7 +3643,8 @@ namespace Grand.Business.System.Services.Installation
IsApproved = true,
StoreId = defaultStore.Id,
Title = "Some sample review",
- ReviewText = string.Format("This sample review is for the {0}. I've been waiting for this product to be available. It is priced just right.", product.Name),
+ ReviewText =
+ $"This sample review is for the {product.Name}. I've been waiting for this product to be available. It is priced just right.",
Rating = rating,
HelpfulYesTotal = 0,
HelpfulNoTotal = 0
diff --git a/src/Business/Grand.Business.System/Services/Installation/InstallationLocalizedService.cs b/src/Business/Grand.Business.System/Services/Installation/InstallationLocalizedService.cs
index 48103fd4e..1a7dada95 100644
--- a/src/Business/Grand.Business.System/Services/Installation/InstallationLocalizedService.cs
+++ b/src/Business/Grand.Business.System/Services/Installation/InstallationLocalizedService.cs
@@ -89,7 +89,7 @@ namespace Grand.Business.System.Services.Installation
foreach (Match match in matches)
languageCode = match.Groups[1].Value;
- var languageNode = xmlDocument.SelectSingleNode(@"//Language");
+ var languageNode = xmlDocument.SelectSingleNode("//Language");
if (languageNode?.Attributes == null)
continue;
@@ -114,7 +114,7 @@ namespace Grand.Business.System.Services.Installation
};
//load resources
- var resources = xmlDocument.SelectNodes(@"//Language/LocaleResource");
+ var resources = xmlDocument.SelectNodes("//Language/LocaleResource");
if (resources == null)
continue;
foreach (XmlNode resNode in resources)
@@ -162,7 +162,7 @@ namespace Grand.Business.System.Services.Installation
var xmlDocument = new XmlDocument { XmlResolver = null };
xmlDocument.Load(File.OpenRead(filePath));
- var collation = xmlDocument.SelectNodes(@"//Collations/Collation");
+ var collation = xmlDocument.SelectNodes("//Collations/Collation");
foreach (XmlNode resNode in collation!)
{
diff --git a/src/Business/Grand.Business.System/Services/Reports/CustomerReportService.cs b/src/Business/Grand.Business.System/Services/Reports/CustomerReportService.cs
index ec095252a..9ba176fdd 100644
--- a/src/Business/Grand.Business.System/Services/Reports/CustomerReportService.cs
+++ b/src/Business/Grand.Business.System/Services/Reports/CustomerReportService.cs
@@ -97,7 +97,7 @@ namespace Grand.Business.System.Services.Reports
query2 = orderBy switch {
1 => query2.OrderByDescending(x => x.OrderTotal),
2 => query2.OrderByDescending(x => x.OrderCount),
- _ => throw new ArgumentException("Wrong orderBy parameter", "orderBy")
+ _ => throw new ArgumentException("Wrong orderBy parameter", nameof(orderBy))
};
var tmp = new PagedList<dynamic>(query2, pageIndex, pageSize);
@@ -130,7 +130,7 @@ namespace Grand.Business.System.Services.Reports
vendorQueryGroup = orderBy switch {
1 => vendorQueryGroup.OrderByDescending(x => x.OrderTotal),
2 => vendorQueryGroup.OrderByDescending(x => x.OrderCount),
- _ => throw new ArgumentException("Wrong orderBy parameter", "orderBy")
+ _ => throw new ArgumentException("Wrong orderBy parameter", nameof(orderBy))
};
var vendorReport = new PagedList<dynamic>(vendorQueryGroup, pageIndex, pageSize);
diff --git a/src/Business/Grand.Business.System/Services/Reports/OrderReportService.cs b/src/Business/Grand.Business.System/Services/Reports/OrderReportService.cs
index cf7ae99e6..cd06e3a46 100644
--- a/src/Business/Grand.Business.System/Services/Reports/OrderReportService.cs
+++ b/src/Business/Grand.Business.System/Services/Reports/OrderReportService.cs
@@ -303,7 +303,7 @@ namespace Grand.Business.System.Services.Reports
}).ToList();
- var item2 = query.Count() > 0 ? query.FirstOrDefault() : new OrderAverageReportLine {
+ var item2 = query.Count > 0 ? query.FirstOrDefault() : new OrderAverageReportLine {
CountOrders = 0,
SumShippingExclTax = 0,
SumTax = 0,
@@ -320,8 +320,9 @@ namespace Grand.Business.System.Services.Reports
/// <returns>Result</returns>
public virtual async Task<OrderAverageReportLineSummary> OrderAverageReport(string storeId, int os)
{
- var item = new OrderAverageReportLineSummary();
- item.OrderStatus = os;
+ var item = new OrderAverageReportLineSummary {
+ OrderStatus = os
+ };
DateTime nowDt = _dateTimeService.ConvertToUserTime(DateTime.Now);
TimeZoneInfo timeZone = _dateTimeService.CurrentTimeZone;
diff --git a/src/Core/Grand.Data/LiteDb/LiteDBRepository.cs b/src/Core/Grand.Data/LiteDb/LiteDBRepository.cs
index dc3640d6f..e5c3a1372 100644
--- a/src/Core/Grand.Data/LiteDb/LiteDBRepository.cs
+++ b/src/Core/Grand.Data/LiteDb/LiteDBRepository.cs
@@ -20,11 +20,7 @@ namespace Grand.Data.LiteDb
/// </summary>
protected ILiteCollection<T> _collection;
- public ILiteCollection<T> Collection {
- get {
- return _collection;
- }
- }
+ public ILiteCollection<T> Collection => _collection;
/// <summary>
/// Sets a collection
@@ -39,11 +35,7 @@ namespace Grand.Data.LiteDb
/// Mongo Database
/// </summary>
protected LiteDatabase _database;
- public LiteDatabase Database {
- get {
- return _database;
- }
- }
+ public LiteDatabase Database => _database;
#endregion
@@ -582,9 +574,7 @@ namespace Grand.Data.LiteDb
/// <summary>
/// Gets a table
/// </summary>
- public virtual IQueryable<T> Table {
- get { return _collection.Query().ToEnumerable().AsQueryable(); }
- }
+ public virtual IQueryable<T> Table => _collection.Query().ToEnumerable().AsQueryable();
/// <summary>
/// Gets a table collection
@@ -627,7 +617,7 @@ namespace Grand.Data.LiteDb
const string format = "Expression '{0}' not supported.";
var message = string.Format(format, Field);
- throw new ArgumentException(message, "Field");
+ throw new ArgumentException(message, nameof(Field));
}
}
diff --git a/src/Core/Grand.Data/Mongo/MongoDBContext.cs b/src/Core/Grand.Data/Mongo/MongoDBContext.cs
index c964a3f09..7a4f2153a 100644
--- a/src/Core/Grand.Data/Mongo/MongoDBContext.cs
+++ b/src/Core/Grand.Data/Mongo/MongoDBContext.cs
@@ -86,8 +86,9 @@ namespace Grand.Data.Mongo
if (!string.IsNullOrEmpty(collation))
{
- var options = new CreateCollectionOptions();
- options.Collation = new Collation(collation);
+ var options = new CreateCollectionOptions {
+ Collation = new Collation(collation)
+ };
await _database.CreateCollectionAsync(name, options);
}
else
diff --git a/src/Core/Grand.Data/Mongo/MongoRepository.cs b/src/Core/Grand.Data/Mongo/MongoRepository.cs
index 4ea918eaa..a4e4594e2 100644
--- a/src/Core/Grand.Data/Mongo/MongoRepository.cs
+++ b/src/Core/Grand.Data/Mongo/MongoRepository.cs
@@ -20,11 +20,7 @@ namespace Grand.Data.Mongo
/// </summary>
protected IMongoCollection<T> _collection;
- public IMongoCollection<T> Collection {
- get {
- return _collection;
- }
- }
+ public IMongoCollection<T> Collection => _collection;
/// <summary>
/// Sets a collection
@@ -40,11 +36,7 @@ namespace Grand.Data.Mongo
/// </summary>
protected IMongoDatabase _database;
- public IMongoDatabase Database {
- get {
- return _database;
- }
- }
+ public IMongoDatabase Database => _database;
#endregion
@@ -465,9 +457,7 @@ namespace Grand.Data.Mongo
/// <summary>
/// Gets a table
/// </summary>
- public virtual IQueryable<T> Table {
- get { return _collection.AsQueryable(); }
- }
+ public virtual IQueryable<T> Table => _collection.AsQueryable();
/// <summary>
/// Gets a table collection
diff --git a/src/Core/Grand.Data/OrderBuilder.cs b/src/Core/Grand.Data/OrderBuilder.cs
index 64344e510..6eeed7739 100644
--- a/src/Core/Grand.Data/OrderBuilder.cs
+++ b/src/Core/Grand.Data/OrderBuilder.cs
@@ -39,8 +39,6 @@ namespace Grand.Data
return this;
}
- public IEnumerable<(Expression<Func<T, object>> selector, bool value, string fieldName)> Fields {
- get { return _list; }
- }
+ public IEnumerable<(Expression<Func<T, object>> selector, bool value, string fieldName)> Fields => _list;
}
}
diff --git a/src/Core/Grand.Data/UpdateBuilder.cs b/src/Core/Grand.Data/UpdateBuilder.cs
index 3d8c9902e..ad78c6302 100644
--- a/src/Core/Grand.Data/UpdateBuilder.cs
+++ b/src/Core/Grand.Data/UpdateBuilder.cs
@@ -26,13 +26,9 @@ namespace Grand.Data
return this;
}
- public IEnumerable<UpdateDefinition<T>> Fields {
- get { return _list; }
- }
+ public IEnumerable<UpdateDefinition<T>> Fields => _list;
- public IEnumerable<ExpressionFieldDefinition<T, object>> ExpressionFields {
- get { return _expressionFieldDefinitions; }
- }
+ public IEnumerable<ExpressionFieldDefinition<T, object>> ExpressionFields => _expressionFieldDefinitions;
}
}
diff --git a/src/Core/Grand.Domain/Catalog/Brand.cs b/src/Core/Grand.Domain/Catalog/Brand.cs
index e657ab7d2..27db2bb3e 100644
--- a/src/Core/Grand.Domain/Catalog/Brand.cs
+++ b/src/Core/Grand.Domain/Catalog/Brand.cs
@@ -129,8 +129,8 @@ namespace Grand.Domain.Catalog
/// </summary>
public virtual ICollection<string> AppliedDiscounts
{
- get { return _appliedDiscounts ??= new List<string>(); }
- protected set { _appliedDiscounts = value; }
+ get => _appliedDiscounts ??= new List<string>();
+ protected set => _appliedDiscounts = value;
}
}
}
diff --git a/src/Core/Grand.Domain/Catalog/Category.cs b/src/Core/Grand.Domain/Catalog/Category.cs
index 10a1302a7..25a3eb879 100644
--- a/src/Core/Grand.Domain/Catalog/Category.cs
+++ b/src/Core/Grand.Domain/Catalog/Category.cs
@@ -165,8 +165,8 @@ namespace Grand.Domain.Catalog
/// </summary>
public virtual ICollection<string> AppliedDiscounts
{
- get { return _appliedDiscounts ??= new List<string>(); }
- protected set { _appliedDiscounts = value; }
+ get => _appliedDiscounts ??= new List<string>();
+ protected set => _appliedDiscounts = value;
}
}
}
diff --git a/src/Core/Grand.Domain/Catalog/Collection.cs b/src/Core/Grand.Domain/Catalog/Collection.cs
index 2e5c7dd4c..fb964dc8e 100644
--- a/src/Core/Grand.Domain/Catalog/Collection.cs
+++ b/src/Core/Grand.Domain/Catalog/Collection.cs
@@ -134,8 +134,8 @@ namespace Grand.Domain.Catalog
/// </summary>
public virtual ICollection<string> AppliedDiscounts
{
- get { return _appliedDiscounts ??= new List<string>(); }
- protected set { _appliedDiscounts = value; }
+ get => _appliedDiscounts ??= new List<string>();
+ protected set => _appliedDiscounts = value;
}
}
}
diff --git a/src/Core/Grand.Domain/Catalog/Product.cs b/src/Core/Grand.Domain/Catalog/Product.cs
index 8dc52e1df..2a0ea8255 100644
--- a/src/Core/Grand.Domain/Catalog/Product.cs
+++ b/src/Core/Grand.Domain/Catalog/Product.cs
@@ -568,8 +568,8 @@ namespace Grand.Domain.Catalog
/// </summary>
public virtual ICollection<ProductCategory> ProductCategories
{
- get { return _productCategories ??= new List<ProductCategory>(); }
- protected set { _productCategories = value; }
+ get => _productCategories ??= new List<ProductCategory>();
+ protected set => _productCategories = value;
}
/// <summary>
@@ -577,8 +577,8 @@ namespace Grand.Domain.Catalog
/// </summary>
public virtual ICollection<ProductCollection> ProductCollections
{
- get { return _productCollections ??= new List<ProductCollection>(); }
- protected set { _productCollections = value; }
+ get => _productCollections ??= new List<ProductCollection>();
+ protected set => _productCollections = value;
}
/// <summary>
@@ -586,8 +586,8 @@ namespace Grand.Domain.Catalog
/// </summary>
public virtual ICollection<ProductPicture> ProductPictures
{
- get { return _productPictures ??= new List<ProductPicture>(); }
- protected set { _productPictures = value; }
+ get => _productPictures ??= new List<ProductPicture>();
+ protected set => _productPictures = value;
}
/// <summary>
@@ -595,8 +595,8 @@ namespace Grand.Domain.Catalog
/// </summary>
public virtual ICollection<ProductSpecificationAttribute> ProductSpecificationAttributes
{
- get { return _productSpecificationAttributes ??= new List<ProductSpecificationAttribute>(); }
- protected set { _productSpecificationAttributes = value; }
+ get => _productSpecificationAttributes ??= new List<ProductSpecificationAttribute>();
+ protected set => _productSpecificationAttributes = value;
}
/// <summary>
@@ -604,8 +604,8 @@ namespace Grand.Domain.Catalog
/// </summary>
public virtual ICollection<string> ProductTags
{
- get { return _productTags ??= new List<string>(); }
- protected set { _productTags = value; }
+ get => _productTags ??= new List<string>();
+ protected set => _productTags = value;
}
/// <summary>
@@ -613,8 +613,8 @@ namespace Grand.Domain.Catalog
/// </summary>
public virtual ICollection<ProductAttributeMapping> ProductAttributeMappings
{
- get { return _productAttributeMappings ??= new List<ProductAttributeMapping>(); }
- protected set { _productAttributeMappings = value; }
+ get => _productAttributeMappings ??= new List<ProductAttributeMapping>();
+ protected set => _productAttributeMappings = value;
}
/// <summary>
@@ -622,23 +622,23 @@ namespace Grand.Domain.Catalog
/// </summary>
public virtual ICollection<ProductAttributeCombination> ProductAttributeCombinations
{
- get { return _productAttributeCombinations ??= new List<ProductAttributeCombination>(); }
- protected set { _productAttributeCombinations = value; }
+ get => _productAttributeCombinations ??= new List<ProductAttributeCombination>();
+ protected set => _productAttributeCombinations = value;
}
/// <summary>
/// Gets or sets the product prices
/// </summary>
public virtual ICollection<ProductPrice> ProductPrices {
- get { return _productPrices ??= new List<ProductPrice>(); }
- protected set { _productPrices = value; }
+ get => _productPrices ??= new List<ProductPrice>();
+ protected set => _productPrices = value;
}
/// <summary>
/// Gets or sets the tier prices
/// </summary>
public virtual ICollection<TierPrice> TierPrices
{
- get { return _tierPrices ??= new List<TierPrice>(); }
- protected set { _tierPrices = value; }
+ get => _tierPrices ??= new List<TierPrice>();
+ protected set => _tierPrices = value;
}
/// <summary>
@@ -646,8 +646,8 @@ namespace Grand.Domain.Catalog
/// </summary>
public virtual ICollection<string> AppliedDiscounts
{
- get { return _appliedDiscounts ??= new List<string>(); }
- protected set { _appliedDiscounts = value; }
+ get => _appliedDiscounts ??= new List<string>();
+ protected set => _appliedDiscounts = value;
}
/// <summary>
@@ -655,35 +655,35 @@ namespace Grand.Domain.Catalog
/// </summary>
public virtual ICollection<ProductWarehouseInventory> ProductWarehouseInventory
{
- get { return _productWarehouseInventory ??= new List<ProductWarehouseInventory>(); }
- protected set { _productWarehouseInventory = value; }
+ get => _productWarehouseInventory ??= new List<ProductWarehouseInventory>();
+ protected set => _productWarehouseInventory = value;
}
public virtual ICollection<string> CrossSellProduct
{
- get { return _crossSellProduct ??= new List<string>(); }
- protected set { _crossSellProduct = value; }
+ get => _crossSellProduct ??= new List<string>();
+ protected set => _crossSellProduct = value;
}
public virtual ICollection<string> RecommendedProduct
{
- get { return _recommendedProduct ??= new List<string>(); }
- protected set { _recommendedProduct = value; }
+ get => _recommendedProduct ??= new List<string>();
+ protected set => _recommendedProduct = value;
}
public virtual ICollection<RelatedProduct> RelatedProducts
{
- get { return _relatedProduct ??= new List<RelatedProduct>(); }
- protected set { _relatedProduct = value; }
+ get => _relatedProduct ??= new List<RelatedProduct>();
+ protected set => _relatedProduct = value;
}
public virtual ICollection<SimilarProduct> SimilarProducts {
- get { return _similarProduct ??= new List<SimilarProduct>(); }
- protected set { _similarProduct = value; }
+ get => _similarProduct ??= new List<SimilarProduct>();
+ protected set => _similarProduct = value;
}
public virtual ICollection<BundleProduct> BundleProducts
{
- get { return _bundleProduct ??= new List<BundleProduct>(); }
- protected set { _bundleProduct = value; }
+ get => _bundleProduct ??= new List<BundleProduct>();
+ protected set => _bundleProduct = value;
}
}
diff --git a/src/Core/Grand.Domain/Catalog/ProductAttributeCombination.cs b/src/Core/Grand.Domain/Catalog/ProductAttributeCombination.cs
index b503066cd..ecbd2dd80 100644
--- a/src/Core/Grand.Domain/Catalog/ProductAttributeCombination.cs
+++ b/src/Core/Grand.Domain/Catalog/ProductAttributeCombination.cs
@@ -69,8 +69,8 @@ namespace Grand.Domain.Catalog
/// </summary>
public virtual ICollection<ProductCombinationWarehouseInventory> WarehouseInventory
{
- get { return _warehouseInventory ??= new List<ProductCombinationWarehouseInventory>(); }
- protected set { _warehouseInventory = value; }
+ get => _warehouseInventory ??= new List<ProductCombinationWarehouseInventory>();
+ protected set => _warehouseInventory = value;
}
/// <summary>
@@ -78,8 +78,8 @@ namespace Grand.Domain.Catalog
/// </summary>
public virtual ICollection<ProductCombinationTierPrices> TierPrices
{
- get { return _tierPrices ??= new List<ProductCombinationTierPrices>(); }
- protected set { _tierPrices = value; }
+ get => _tierPrices ??= new List<ProductCombinationTierPrices>();
+ protected set => _tierPrices = value;
}
public object Clone()
diff --git a/src/Core/Grand.Domain/Catalog/ProductAttributeMapping.cs b/src/Core/Grand.Domain/Catalog/ProductAttributeMapping.cs
index c819462c1..95875af9a 100644
--- a/src/Core/Grand.Domain/Catalog/ProductAttributeMapping.cs
+++ b/src/Core/Grand.Domain/Catalog/ProductAttributeMapping.cs
@@ -85,8 +85,8 @@ namespace Grand.Domain.Catalog
/// </summary>
public virtual ICollection<ProductAttributeValue> ProductAttributeValues
{
- get { return _productAttributeValues ??= new List<ProductAttributeValue>(); }
- protected set { _productAttributeValues = value; }
+ get => _productAttributeValues ??= new List<ProductAttributeValue>();
+ protected set => _productAttributeValues = value;
}
}
diff --git a/src/Core/Grand.Domain/Catalog/ProductReview.cs b/src/Core/Grand.Domain/Catalog/ProductReview.cs
index 33fd659e3..a58a9b027 100644
--- a/src/Core/Grand.Domain/Catalog/ProductReview.cs
+++ b/src/Core/Grand.Domain/Catalog/ProductReview.cs
@@ -71,8 +71,8 @@ namespace Grand.Domain.Catalog
/// </summary>
public virtual ICollection<ProductReviewHelpfulness> ProductReviewHelpfulnessEntries
{
- get { return _productReviewHelpfulnessEntries ??= new List<ProductReviewHelpfulness>(); }
- protected set { _productReviewHelpfulnessEntries = value; }
+ get => _productReviewHelpfulnessEntries ??= new List<ProductReviewHelpfulness>();
+ protected set => _productReviewHelpfulnessEntries = value;
}
}
}
diff --git a/src/Core/Grand.Domain/Catalog/SpecificationAttribute.cs b/src/Core/Grand.Domain/Catalog/SpecificationAttribute.cs
index 27c45ddb5..fc133f8a2 100644
--- a/src/Core/Grand.Domain/Catalog/SpecificationAttribute.cs
+++ b/src/Core/Grand.Domain/Catalog/SpecificationAttribute.cs
@@ -41,8 +41,8 @@ namespace Grand.Domain.Catalog
/// </summary>
public virtual ICollection<SpecificationAttributeOption> SpecificationAttributeOptions
{
- get { return _specificationAttributeOptions ??= new List<SpecificationAttributeOption>(); }
- protected set { _specificationAttributeOptions = value; }
+ get => _specificationAttributeOptions ??= new List<SpecificationAttributeOption>();
+ protected set => _specificationAttributeOptions = value;
}
}
}
diff --git a/src/Core/Grand.Domain/Common/AddressAttribute.cs b/src/Core/Grand.Domain/Common/AddressAttribute.cs
index fe71512ae..2f493d8b6 100644
--- a/src/Core/Grand.Domain/Common/AddressAttribute.cs
+++ b/src/Core/Grand.Domain/Common/AddressAttribute.cs
@@ -41,22 +41,16 @@ namespace Grand.Domain.Common
/// </summary>
public AttributeControlType AttributeControlType
{
- get
- {
- return (AttributeControlType)AttributeControlTypeId;
- }
- set
- {
- AttributeControlTypeId = (int)value;
- }
+ get => (AttributeControlType)AttributeControlTypeId;
+ set => AttributeControlTypeId = (int)value;
}
/// <summary>
/// Gets the address attribute values
/// </summary>
public virtual ICollection<AddressAttributeValue> AddressAttributeValues
{
- get { return _addressAttributeValues ??= new List<AddressAttributeValue>(); }
- protected set { _addressAttributeValues = value; }
+ get => _addressAttributeValues ??= new List<AddressAttributeValue>();
+ protected set => _addressAttributeValues = value;
}
}
diff --git a/src/Core/Grand.Domain/Customers/Customer.cs b/src/Core/Grand.Domain/Customers/Customer.cs
index 90ff5dd26..e5379e7f9 100644
--- a/src/Core/Grand.Domain/Customers/Customer.cs
+++ b/src/Core/Grand.Domain/Customers/Customer.cs
@@ -177,8 +177,8 @@ namespace Grand.Domain.Customers
/// </summary>
public virtual ICollection<string> Groups
{
- get { return _groups ??= new List<string>(); }
- protected set { _groups = value; }
+ get => _groups ??= new List<string>();
+ protected set => _groups = value;
}
/// <summary>
@@ -186,8 +186,8 @@ namespace Grand.Domain.Customers
/// </summary>
public virtual ICollection<ShoppingCartItem> ShoppingCartItems
{
- get { return _shoppingCartItems ??= new List<ShoppingCartItem>(); }
- protected set { _shoppingCartItems = value; }
+ get => _shoppingCartItems ??= new List<ShoppingCartItem>();
+ protected set => _shoppingCartItems = value;
}
/// <summary>
@@ -210,8 +210,8 @@ namespace Grand.Domain.Customers
/// </summary>
public virtual ICollection<Address> Addresses
{
- get { return _addresses ??= new List<Address>(); }
- protected set { _addresses = value; }
+ get => _addresses ??= new List<Address>();
+ protected set => _addresses = value;
}
/// <summary>
@@ -219,8 +219,8 @@ namespace Grand.Domain.Customers
/// </summary>
public virtual ICollection<string> CustomerTags
{
- get { return _customerTags ??= new List<string>(); }
- protected set { _customerTags = value; }
+ get => _customerTags ??= new List<string>();
+ protected set => _customerTags = value;
}
#endregion
}
diff --git a/src/Core/Grand.Domain/Customers/CustomerAttribute.cs b/src/Core/Grand.Domain/Customers/CustomerAttribute.cs
index 35363949e..5497206af 100644
--- a/src/Core/Grand.Domain/Customers/CustomerAttribute.cs
+++ b/src/Core/Grand.Domain/Customers/CustomerAttribute.cs
@@ -45,8 +45,8 @@ namespace Grand.Domain.Customers
/// </summary>
public virtual ICollection<CustomerAttributeValue> CustomerAttributeValues
{
- get { return _customerAttributeValues ??= new List<CustomerAttributeValue>(); }
- protected set { _customerAttributeValues = value; }
+ get => _customerAttributeValues ??= new List<CustomerAttributeValue>();
+ protected set => _customerAttributeValues = value;
}
}
diff --git a/src/Core/Grand.Domain/Customers/CustomerExtensions.cs b/src/Core/Grand.Domain/Customers/CustomerExtensions.cs
index 8fc3ed4d8..e0fd6287d 100644
--- a/src/Core/Grand.Domain/Customers/CustomerExtensions.cs
+++ b/src/Core/Grand.Domain/Customers/CustomerExtensions.cs
@@ -72,7 +72,7 @@ namespace Grand.Domain.Customers
var fullName = "";
if (!String.IsNullOrWhiteSpace(firstName) && !String.IsNullOrWhiteSpace(lastName))
- fullName = string.Format("{0} {1}", firstName, lastName);
+ fullName = $"{firstName} {lastName}";
else
{
if (!String.IsNullOrWhiteSpace(firstName))
diff --git a/src/Core/Grand.Domain/Customers/SystemCustomerFieldNames.cs b/src/Core/Grand.Domain/Customers/SystemCustomerFieldNames.cs
index b13433866..10a603590 100644
--- a/src/Core/Grand.Domain/Customers/SystemCustomerFieldNames.cs
+++ b/src/Core/Grand.Domain/Customers/SystemCustomerFieldNames.cs
@@ -3,56 +3,58 @@ namespace Grand.Domain.Customers
public static class SystemCustomerFieldNames
{
//Form fields
- public static string FirstName { get { return "FirstName"; } }
- public static string LastName { get { return "LastName"; } }
- public static string Gender { get { return "Gender"; } }
- public static string DateOfBirth { get { return "DateOfBirth"; } }
- public static string Company { get { return "Company"; } }
- public static string StreetAddress { get { return "StreetAddress"; } }
- public static string StreetAddress2 { get { return "StreetAddress2"; } }
- public static string ZipPostalCode { get { return "ZipPostalCode"; } }
- public static string City { get { return "City"; } }
- public static string CountryId { get { return "CountryId"; } }
- public static string StateProvinceId { get { return "StateProvinceId"; } }
- public static string Phone { get { return "Phone"; } }
- public static string Fax { get { return "Fax"; } }
- public static string VatNumber { get { return "VatNumber"; } }
- public static string VatNumberStatusId { get { return "VatNumberStatusId"; } }
- public static string PasswordToken { get { return "PasswordToken"; } }
+ public static string FirstName => "FirstName";
+ public static string LastName => "LastName";
+ public static string Gender => "Gender";
+ public static string DateOfBirth => "DateOfBirth";
+ public static string Company => "Company";
+ public static string StreetAddress => "StreetAddress";
+ public static string StreetAddress2 => "StreetAddress2";
+ public static string ZipPostalCode => "ZipPostalCode";
+ public static string City => "City";
+ public static string CountryId => "CountryId";
+ public static string StateProvinceId => "StateProvinceId";
+ public static string Phone => "Phone";
+ public static string Fax => "Fax";
+ public static string VatNumber => "VatNumber";
+ public static string VatNumberStatusId => "VatNumberStatusId";
+ public static string PasswordToken => "PasswordToken";
//Other attributes
- public static string DiscountCoupons { get { return "DiscountCoupons"; } }
- public static string GiftVoucherCoupons { get { return "GiftVoucherCoupons"; } }
- public static string UrlReferrer { get { return "UrlReferrer"; } }
- public static string PasswordRecoveryToken { get { return "PasswordRecoveryToken"; } }
- public static string PasswordRecoveryTokenDateGenerated { get { return "PasswordRecoveryTokenDateGenerated"; } }
- public static string AccountActivationToken { get { return "AccountActivationToken"; } }
- public static string LastVisitedPage { get { return "LastVisitedPage"; } }
- public static string LastUrlReferrer { get { return "LastUrlReferrer"; } }
- public static string ImpersonatedCustomerId { get { return "ImpersonatedCustomerId"; } }
- public static string AdminAreaStoreScopeConfiguration { get { return "AdminAreaStoreScopeConfiguration"; } }
- public static string TwoFactorEnabled { get { return "TwoFactorEnabled"; } }
- public static string TwoFactorSecretKey { get { return "TwoFactorSecretKey"; } }
- public static string TwoFactorValidCode { get { return "TwoFactorValidCode"; } }
- public static string TwoFactorCodeValidUntil { get { return "TwoFactorValidCodeUntil"; } }
+ public static string DiscountCoupons => "DiscountCoupons";
+ public static string GiftVoucherCoupons => "GiftVoucherCoupons";
+ public static string UrlReferrer => "UrlReferrer";
+ public static string PasswordRecoveryToken => "PasswordRecoveryToken";
+ public static string PasswordRecoveryTokenDateGenerated => "PasswordRecoveryTokenDateGenerated";
+ public static string AccountActivationToken => "AccountActivationToken";
+ public static string LastVisitedPage => "LastVisitedPage";
+ public static string LastUrlReferrer => "LastUrlReferrer";
+ public static string ImpersonatedCustomerId => "ImpersonatedCustomerId";
+ public static string AdminAreaStoreScopeConfiguration => "AdminAreaStoreScopeConfiguration";
+ public static string TwoFactorEnabled => "TwoFactorEnabled";
+ public static string TwoFactorSecretKey => "TwoFactorSecretKey";
+ public static string TwoFactorValidCode => "TwoFactorValidCode";
+ public static string TwoFactorCodeValidUntil => "TwoFactorValidCodeUntil";
+
+ public static string CurrencyId => "CurrencyId";
+ public static string LanguageId => "LanguageId";
+ public static string SelectedPaymentMethod => "SelectedPaymentMethod";
+ public static string PaymentTransaction => "PaymentTransaction";
+ public static string PaymentOptionAttribute => "PaymentOptionAttribute";
+
+ public static string SelectedShippingOption => "SelectedShippingOption";
- public static string CurrencyId { get { return "CurrencyId"; } }
- public static string LanguageId { get { return "LanguageId"; } }
- public static string SelectedPaymentMethod { get { return "SelectedPaymentMethod"; } }
- public static string PaymentTransaction { get { return "PaymentTransaction"; } }
- public static string PaymentOptionAttribute { get { return "PaymentOptionAttribute"; } }
- public static string SelectedShippingOption { get { return "SelectedShippingOption"; } }
//value customer chose "pick up in store" option
- public static string SelectedPickupPoint { get { return "SelectedPickupPoint"; } }
- public static string CheckoutAttributes { get { return "CheckoutAttributes"; } }
- public static string OfferedShippingOptions { get { return "OfferedShippingOptions"; } }
- public static string ShippingOptionAttributeDescription { get { return "ShippingOptionAttributeDescription"; } }
- public static string ShippingOptionAttribute { get { return "ShippingOptionAttribute"; } }
- public static string LastContinueShoppingPage { get { return "LastContinueShoppingPage"; } }
- public static string TaxDisplayTypeId { get { return "TaxDisplayTypeId"; } }
- public static string UseLoyaltyPointsDuringCheckout { get { return "UseLoyaltyPointsDuringCheckout"; } }
- public static string CookieAccepted { get { return "Cookie.Accepted"; } }
- public static string ConsentCookies { get { return "ConsentCookies"; } }
- public static string RefreshToken { get { return "RefreshToken"; } }
+ public static string SelectedPickupPoint => "SelectedPickupPoint";
+ public static string CheckoutAttributes => "CheckoutAttributes";
+ public static string OfferedShippingOptions => "OfferedShippingOptions";
+ public static string ShippingOptionAttributeDescription => "ShippingOptionAttributeDescription";
+ public static string ShippingOptionAttribute => "ShippingOptionAttribute";
+ public static string LastContinueShoppingPage => "LastContinueShoppingPage";
+ public static string TaxDisplayTypeId => "TaxDisplayTypeId";
+ public static string UseLoyaltyPointsDuringCheckout => "UseLoyaltyPointsDuringCheckout";
+ public static string CookieAccepted => "Cookie.Accepted";
+ public static string ConsentCookies => "ConsentCookies";
+ public static string RefreshToken => "RefreshToken";
}
}
\ No newline at end of file
diff --git a/src/Core/Grand.Domain/Customers/SystemCustomerNames.cs b/src/Core/Grand.Domain/Customers/SystemCustomerNames.cs
index 48c8d0db9..52d0c5f5f 100644
--- a/src/Core/Grand.Domain/Customers/SystemCustomerNames.cs
+++ b/src/Core/Grand.Domain/Customers/SystemCustomerNames.cs
@@ -2,8 +2,8 @@ namespace Grand.Domain.Customers
{
public static class SystemCustomerNames
{
- public static string Anonymous { get { return "Anonymous"; } }
- public static string SearchEngine { get { return "SearchEngine"; } }
- public static string BackgroundTask { get { return "BackgroundTask"; } }
+ public static string Anonymous => "Anonymous";
+ public static string SearchEngine => "SearchEngine";
+ public static string BackgroundTask => "BackgroundTask";
}
}
\ No newline at end of file
diff --git a/src/Core/Grand.Domain/Directory/Country.cs b/src/Core/Grand.Domain/Directory/Country.cs
index a331d6215..96bd5e206 100644
--- a/src/Core/Grand.Domain/Directory/Country.cs
+++ b/src/Core/Grand.Domain/Directory/Country.cs
@@ -71,8 +71,8 @@ namespace Grand.Domain.Directory
/// </summary>
public virtual ICollection<StateProvince> StateProvinces
{
- get { return _stateProvinces ??= new List<StateProvince>(); }
- protected set { _stateProvinces = value; }
+ get => _stateProvinces ??= new List<StateProvince>();
+ protected set => _stateProvinces = value;
}
}
diff --git a/src/Core/Grand.Domain/Directory/ExchangeRate.cs b/src/Core/Grand.Domain/Directory/ExchangeRate.cs
index efbb55c51..43b373d1b 100644
--- a/src/Core/Grand.Domain/Directory/ExchangeRate.cs
+++ b/src/Core/Grand.Domain/Directory/ExchangeRate.cs
@@ -36,7 +36,7 @@ namespace Grand.Domain.Directory
/// <returns></returns>
public override string ToString()
{
- return string.Format("{0} {1}", CurrencyCode, Rate);
+ return $"{CurrencyCode} {Rate}";
}
}
diff --git a/src/Core/Grand.Domain/Discounts/Discount.cs b/src/Core/Grand.Domain/Discounts/Discount.cs
index c7ba86da0..066f37719 100644
--- a/src/Core/Grand.Domain/Discounts/Discount.cs
+++ b/src/Core/Grand.Domain/Discounts/Discount.cs
@@ -112,8 +112,8 @@ namespace Grand.Domain.Discounts
/// </summary>
public virtual ICollection<DiscountRule> DiscountRules
{
- get { return _discountRules ??= new List<DiscountRule>(); }
- protected set { _discountRules = value; }
+ get => _discountRules ??= new List<DiscountRule>();
+ protected set => _discountRules = value;
}
}
diff --git a/src/Core/Grand.Domain/Messages/Campaign.cs b/src/Core/Grand.Domain/Messages/Campaign.cs
index 3fc9b8799..0d9e9428c 100644
--- a/src/Core/Grand.Domain/Messages/Campaign.cs
+++ b/src/Core/Grand.Domain/Messages/Campaign.cs
@@ -54,24 +54,24 @@
/// </summary>
public virtual ICollection<string> CustomerTags
{
- get { return _customerTags ??= new List<string>(); }
- protected set { _customerTags = value; }
+ get => _customerTags ??= new List<string>();
+ protected set => _customerTags = value;
}
/// <summary>
/// Gets or sets the customer groups
/// </summary>
public virtual ICollection<string> CustomerGroups
{
- get { return _customerGroups ??= new List<string>(); }
- protected set { _customerGroups = value; }
+ get => _customerGroups ??= new List<string>();
+ protected set => _customerGroups = value;
}
/// <summary>
/// Gets or sets the newsletter categories
/// </summary>
public virtual ICollection<string> NewsletterCategories
{
- get { return _newsletterCategories ??= new List<string>(); }
- protected set { _newsletterCategories = value; }
+ get => _newsletterCategories ??= new List<string>();
+ protected set => _newsletterCategories = value;
}
}
diff --git a/src/Core/Grand.Domain/Messages/ContactAttribute.cs b/src/Core/Grand.Domain/Messages/ContactAttribute.cs
index 3e7e55063..a11deefcb 100644
--- a/src/Core/Grand.Domain/Messages/ContactAttribute.cs
+++ b/src/Core/Grand.Domain/Messages/ContactAttribute.cs
@@ -92,22 +92,16 @@ namespace Grand.Domain.Messages
/// </summary>
public AttributeControlType AttributeControlType
{
- get
- {
- return (AttributeControlType)AttributeControlTypeId;
- }
- set
- {
- AttributeControlTypeId = (int)value;
- }
+ get => (AttributeControlType)AttributeControlTypeId;
+ set => AttributeControlTypeId = (int)value;
}
/// <summary>
/// Gets the checkout attribute values
/// </summary>
public virtual ICollection<ContactAttributeValue> ContactAttributeValues
{
- get { return _contactAttributeValues ??= new List<ContactAttributeValue>(); }
- protected set { _contactAttributeValues = value; }
+ get => _contactAttributeValues ??= new List<ContactAttributeValue>();
+ protected set => _contactAttributeValues = value;
}
}
diff --git a/src/Core/Grand.Domain/Messages/NewsLetterSubscription.cs b/src/Core/Grand.Domain/Messages/NewsLetterSubscription.cs
index d662680b6..30041531c 100644
--- a/src/Core/Grand.Domain/Messages/NewsLetterSubscription.cs
+++ b/src/Core/Grand.Domain/Messages/NewsLetterSubscription.cs
@@ -39,8 +39,8 @@ namespace Grand.Domain.Messages
/// </summary>
public virtual ICollection<string> Categories
{
- get { return _categories ??= new List<string>(); }
- protected set { _categories = value; }
+ get => _categories ??= new List<string>();
+ protected set => _categories = value;
}
}
}
diff --git a/src/Core/Grand.Domain/News/NewsItem.cs b/src/Core/Grand.Domain/News/NewsItem.cs
index 31e1d742b..24b7e4e6a 100644
--- a/src/Core/Grand.Domain/News/NewsItem.cs
+++ b/src/Core/Grand.Domain/News/NewsItem.cs
@@ -102,8 +102,8 @@ namespace Grand.Domain.News
/// </summary>
public virtual ICollection<NewsComment> NewsComments
{
- get { return _newsComments ??= new List<NewsComment>(); }
- protected set { _newsComments = value; }
+ get => _newsComments ??= new List<NewsComment>();
+ protected set => _newsComments = value;
}
}
diff --git a/src/Core/Grand.Domain/Orders/CheckoutAttribute.cs b/src/Core/Grand.Domain/Orders/CheckoutAttribute.cs
index b0f0471b6..70b95947c 100644
--- a/src/Core/Grand.Domain/Orders/CheckoutAttribute.cs
+++ b/src/Core/Grand.Domain/Orders/CheckoutAttribute.cs
@@ -108,8 +108,8 @@ namespace Grand.Domain.Orders
/// </summary>
public virtual ICollection<CheckoutAttributeValue> CheckoutAttributeValues
{
- get { return _checkoutAttributeValues ??= new List<CheckoutAttributeValue>(); }
- protected set { _checkoutAttributeValues = value; }
+ get => _checkoutAttributeValues ??= new List<CheckoutAttributeValue>();
+ protected set => _checkoutAttributeValues = value;
}
}
diff --git a/src/Core/Grand.Domain/Orders/GiftVoucher.cs b/src/Core/Grand.Domain/Orders/GiftVoucher.cs
index a34e09d42..2c493d2bc 100644
--- a/src/Core/Grand.Domain/Orders/GiftVoucher.cs
+++ b/src/Core/Grand.Domain/Orders/GiftVoucher.cs
@@ -79,8 +79,8 @@ namespace Grand.Domain.Orders
/// </summary>
public virtual ICollection<GiftVoucherUsageHistory> GiftVoucherUsageHistory
{
- get { return _giftVoucherUsageHistory ??= new List<GiftVoucherUsageHistory>(); }
- protected set { _giftVoucherUsageHistory = value; }
+ get => _giftVoucherUsageHistory ??= new List<GiftVoucherUsageHistory>();
+ protected set => _giftVoucherUsageHistory = value;
}
/// <summary>
diff --git a/src/Core/Grand.Domain/Orders/MerchandiseReturn.cs b/src/Core/Grand.Domain/Orders/MerchandiseReturn.cs
index 44f58e681..10069c8b7 100644
--- a/src/Core/Grand.Domain/Orders/MerchandiseReturn.cs
+++ b/src/Core/Grand.Domain/Orders/MerchandiseReturn.cs
@@ -69,14 +69,8 @@ namespace Grand.Domain.Orders
/// </summary>
public MerchandiseReturnStatus MerchandiseReturnStatus
{
- get
- {
- return (MerchandiseReturnStatus)MerchandiseReturnStatusId;
- }
- set
- {
- MerchandiseReturnStatusId = (int)value;
- }
+ get => (MerchandiseReturnStatus)MerchandiseReturnStatusId;
+ set => MerchandiseReturnStatusId = (int)value;
}
/// <summary>
diff --git a/src/Core/Grand.Domain/Orders/Order.cs b/src/Core/Grand.Domain/Orders/Order.cs
index b494dd512..2141b4a2c 100644
--- a/src/Core/Grand.Domain/Orders/Order.cs
+++ b/src/Core/Grand.Domain/Orders/Order.cs
@@ -317,24 +317,24 @@ namespace Grand.Domain.Orders
/// Gets or sets order items
/// </summary>
public virtual ICollection<OrderItem> OrderItems {
- get { return _orderItems ??= new List<OrderItem>(); }
- protected set { _orderItems = value; }
+ get => _orderItems ??= new List<OrderItem>();
+ protected set => _orderItems = value;
}
/// <summary>
/// Gets or sets order taxes
/// </summary>
public virtual ICollection<OrderTax> OrderTaxes {
- get { return _orderTaxes ??= new List<OrderTax>(); }
- protected set { _orderTaxes = value; }
+ get => _orderTaxes ??= new List<OrderTax>();
+ protected set => _orderTaxes = value;
}
/// <summary>
/// Gets or sets the order's tags
/// </summary>
public virtual ICollection<string> OrderTags {
- get { return _orderTags ??= new List<string>(); }
- protected set { _orderTags = value; }
+ get => _orderTags ??= new List<string>();
+ protected set => _orderTags = value;
}
#endregion
diff --git a/src/Core/Grand.Domain/PagedList.cs b/src/Core/Grand.Domain/PagedList.cs
index fe2c504d4..c5a14efa2 100644
--- a/src/Core/Grand.Domain/PagedList.cs
+++ b/src/Core/Grand.Domain/PagedList.cs
@@ -79,11 +79,8 @@
public int TotalCount { get; protected set; }
public int TotalPages { get; protected set; }
- public bool HasPreviousPage {
- get { return PageIndex > 0; }
- }
- public bool HasNextPage {
- get { return PageIndex + 1 < TotalPages; }
- }
+ public bool HasPreviousPage => PageIndex > 0;
+
+ public bool HasNextPage => PageIndex + 1 < TotalPages;
}
}
diff --git a/src/Core/Grand.Domain/ParentEntity.cs b/src/Core/Grand.Domain/ParentEntity.cs
index 3f8e2af2d..49aca7300 100644
--- a/src/Core/Grand.Domain/ParentEntity.cs
+++ b/src/Core/Grand.Domain/ParentEntity.cs
@@ -12,8 +12,8 @@ namespace Grand.Domain
[DBFieldName("_id")]
public string Id
{
- get { return _id; }
- set { _id = string.IsNullOrEmpty(value) ? UniqueIdentifier.New : value; }
+ get => _id;
+ set => _id = string.IsNullOrEmpty(value) ? UniqueIdentifier.New : value;
}
private string _id;
diff --git a/src/Core/Grand.Domain/Permissions/Permission.cs b/src/Core/Grand.Domain/Permissions/Permission.cs
index 7b45dbf75..a162907e0 100644
--- a/src/Core/Grand.Domain/Permissions/Permission.cs
+++ b/src/Core/Grand.Domain/Permissions/Permission.cs
@@ -33,16 +33,16 @@
/// </summary>
public virtual ICollection<string> CustomerGroups
{
- get { return _customerGroups ??= new List<string>(); }
- protected set { _customerGroups = value; }
+ get => _customerGroups ??= new List<string>();
+ protected set => _customerGroups = value;
}
/// <summary>
/// Gets or sets actions
/// </summary>
public virtual ICollection<string> Actions {
- get { return _actions ??= new List<string>(); }
- set { _actions = value; }
+ get => _actions ??= new List<string>();
+ set => _actions = value;
}
}
}
diff --git a/src/Core/Grand.Domain/Shipping/Shipment.cs b/src/Core/Grand.Domain/Shipping/Shipment.cs
index a78a6dd31..0ab26e982 100644
--- a/src/Core/Grand.Domain/Shipping/Shipment.cs
+++ b/src/Core/Grand.Domain/Shipping/Shipment.cs
@@ -62,8 +62,8 @@ namespace Grand.Domain.Shipping
/// </summary>
public virtual ICollection<ShipmentItem> ShipmentItems
{
- get { return _shipmentItems ??= new List<ShipmentItem>(); }
- protected set { _shipmentItems = value; }
+ get => _shipmentItems ??= new List<ShipmentItem>();
+ protected set => _shipmentItems = value;
}
}
}
\ No newline at end of file
diff --git a/src/Core/Grand.Domain/Shipping/ShippingMethod.cs b/src/Core/Grand.Domain/Shipping/ShippingMethod.cs
index 7dba04c2d..2d3260fb3 100644
--- a/src/Core/Grand.Domain/Shipping/ShippingMethod.cs
+++ b/src/Core/Grand.Domain/Shipping/ShippingMethod.cs
@@ -36,8 +36,8 @@ namespace Grand.Domain.Shipping
/// </summary>
public virtual ICollection<Country> RestrictedCountries
{
- get { return _restrictedCountries ??= new List<Country>(); }
- protected set { _restrictedCountries = value; }
+ get => _restrictedCountries ??= new List<Country>();
+ protected set => _restrictedCountries = value;
}
/// <summary>
@@ -45,8 +45,8 @@ namespace Grand.Domain.Shipping
/// </summary>
public virtual ICollection<string> RestrictedGroups
{
- get { return _restrictedGroups ??= new List<string>(); }
- protected set { _restrictedGroups = value; }
+ get => _restrictedGroups ??= new List<string>();
+ protected set => _restrictedGroups = value;
}
}
}
\ No newline at end of file
diff --git a/src/Core/Grand.Domain/Vendors/Vendor.cs b/src/Core/Grand.Domain/Vendors/Vendor.cs
index 144d366f5..49ce5594e 100644
--- a/src/Core/Grand.Domain/Vendors/Vendor.cs
+++ b/src/Core/Grand.Domain/Vendors/Vendor.cs
@@ -146,16 +146,16 @@ namespace Grand.Domain.Vendors
/// </summary>
public virtual ICollection<VendorNote> VendorNotes
{
- get { return _vendorNotes ??= new List<VendorNote>(); }
- protected set { _vendorNotes = value; }
+ get => _vendorNotes ??= new List<VendorNote>();
+ protected set => _vendorNotes = value;
}
/// <summary>
/// Gets or sets the collection of applied discounts
/// </summary>
public virtual ICollection<string> AppliedDiscounts
{
- get { return _appliedDiscounts ??= new List<string>(); }
- protected set { _appliedDiscounts = value; }
+ get => _appliedDiscounts ??= new List<string>();
+ protected set => _appliedDiscounts = value;
}
}
diff --git a/src/Core/Grand.Domain/Vendors/VendorReview.cs b/src/Core/Grand.Domain/Vendors/VendorReview.cs
index 042f00c6a..8af53d8c1 100644
--- a/src/Core/Grand.Domain/Vendors/VendorReview.cs
+++ b/src/Core/Grand.Domain/Vendors/VendorReview.cs
@@ -52,8 +52,8 @@
/// </summary>
public virtual ICollection<VendorReviewHelpfulness> VendorReviewHelpfulnessEntries
{
- get { return _vendorReviewHelpfulnessEntries ??= new List<VendorReviewHelpfulness>(); }
- protected set { _vendorReviewHelpfulnessEntries = value; }
+ get => _vendorReviewHelpfulnessEntries ??= new List<VendorReviewHelpfulness>();
+ protected set => _vendorReviewHelpfulnessEntries = value;
}
}
}
diff --git a/src/Core/Grand.SharedKernel/Attributes/DBFieldNameAttribute.cs b/src/Core/Grand.SharedKernel/Attributes/DBFieldNameAttribute.cs
index 1c5dfe326..48aec32e2 100644
--- a/src/Core/Grand.SharedKernel/Attributes/DBFieldNameAttribute.cs
+++ b/src/Core/Grand.SharedKernel/Attributes/DBFieldNameAttribute.cs
@@ -9,8 +9,6 @@
{
this.name = name;
}
- public virtual string Name {
- get { return name; }
- }
+ public virtual string Name => name;
}
}
diff --git a/src/Core/Grand.SharedKernel/Extensions/CommonHelper.cs b/src/Core/Grand.SharedKernel/Extensions/CommonHelper.cs
index abac4acff..2306dc9f8 100644
--- a/src/Core/Grand.SharedKernel/Extensions/CommonHelper.cs
+++ b/src/Core/Grand.SharedKernel/Extensions/CommonHelper.cs
@@ -88,7 +88,7 @@ namespace Grand.SharedKernel.Extensions
if (str.Length > maxLength)
{
- var pLen = postfix == null ? 0 : postfix.Length;
+ var pLen = postfix?.Length ?? 0;
var result = str[..(maxLength - pLen)];
if(string.IsNullOrEmpty(result))
diff --git a/src/Core/Grand.SharedKernel/Extensions/CommonPath.cs b/src/Core/Grand.SharedKernel/Extensions/CommonPath.cs
index 8bf7a21af..831d5d1a0 100644
--- a/src/Core/Grand.SharedKernel/Extensions/CommonPath.cs
+++ b/src/Core/Grand.SharedKernel/Extensions/CommonPath.cs
@@ -23,102 +23,57 @@
/// Maps a settings path to a physical disk path.
/// </summary>
/// <returns>The physical path.</returns>
- public static string DataProtectionKeysPath
- {
- get
- {
- return Path.Combine(BaseDirectory, AppData, Param, "DataProtectionKeys");
- }
- }
+ public static string DataProtectionKeysPath => Path.Combine(BaseDirectory, AppData, Param, "DataProtectionKeys");
/// <summary>
/// Maps a settings path to a physical disk path.
/// </summary>
/// <returns>The physical path.</returns>
- public static string SettingsPath
- {
- get
- {
- return Path.Combine(BaseDirectory, AppData, Param, "Settings.cfg");
- }
- }
+ public static string SettingsPath => Path.Combine(BaseDirectory, AppData, Param, "Settings.cfg");
/// <summary>
/// Maps a theme path to a physical disk path.
/// </summary>
/// <returns>The physical path.</returns>
- public static string PluginsPath
- {
- get
- {
- return Path.Combine(BaseDirectory, "Plugins");
- }
- }
+ public static string PluginsPath => Path.Combine(BaseDirectory, "Plugins");
/// <summary>
/// Maps a image path.
/// </summary>
/// <returns>The path.</returns>
- public static string ImagePath {
- get {
- return Path.Combine("assets", "images");
- }
- }
+ public static string ImagePath => Path.Combine("assets", "images");
/// <summary>
/// Maps a image thumb path.
/// </summary>
/// <returns>The path.</returns>
- public static string ImageThumbPath {
- get {
- return Path.Combine("assets", "images", "thumbs");
- }
- }
+ public static string ImageThumbPath => Path.Combine("assets", "images", "thumbs");
/// <summary>
/// Maps a image upload path.
/// </summary>
/// <returns>The path.</returns>
- public static string ImageUploadedPath {
- get {
- return Path.Combine("assets", "images", "uploaded");
- }
- }
+ public static string ImageUploadedPath => Path.Combine("assets", "images", "uploaded");
/// <summary>
/// Maps a installled plugins path to a physical disk path.
/// </summary>
/// <returns>The physical path.</returns>
- public static string InstalledPluginsFilePath
- {
- get
- {
- return Path.Combine(BaseDirectory, AppData, Param, "InstalledPlugins.cfg");
- }
- }
+ public static string InstalledPluginsFilePath => Path.Combine(BaseDirectory, AppData, Param, "InstalledPlugins.cfg");
+
/// <summary>
/// Maps a installled plugins path to a physical disk path.
/// </summary>
/// <returns>The physical path.</returns>
- public static string PluginsCopyPath
- {
- get
- {
- return Path.Combine(BaseDirectory, PluginsPath, "bin");
- }
- }
+ public static string PluginsCopyPath => Path.Combine(BaseDirectory, PluginsPath, "bin");
+
/// <summary>
/// Maps a temp upload path to a physical disk path.
/// </summary>
/// <returns>The physical path.</returns>
- public static string TmpUploadPath
- {
- get
- {
- return Path.Combine(BaseDirectory, AppData, Param, "TempUploads");
- }
- }
+ public static string TmpUploadPath => Path.Combine(BaseDirectory, AppData, Param, "TempUploads");
+
/// <summary>
/// Gets or sets application base path
/// </summary>
@@ -138,13 +93,7 @@
/// <summary>
/// Gets or sets web application content files
/// </summary>
- public static string WebRootPath
- {
- get
- {
- return Path.Combine(WebHostEnvironment, Param);
- }
- }
+ public static string WebRootPath => Path.Combine(WebHostEnvironment, Param);
/// <summary>
/// Maps a virtual path to a physical disk path. (not for tenants)
diff --git a/src/Plugins/Payments.BrainTree/Validators/PaymentInfoValidator.cs b/src/Plugins/Payments.BrainTree/Validators/PaymentInfoValidator.cs
index aa95816e3..01a097a3c 100644
--- a/src/Plugins/Payments.BrainTree/Validators/PaymentInfoValidator.cs
+++ b/src/Plugins/Payments.BrainTree/Validators/PaymentInfoValidator.cs
@@ -17,7 +17,7 @@ namespace Payments.BrainTree.Validators
RuleFor(x => x.CardholderName).NotEmpty().WithMessage(translationService.GetResource("Payment.CardholderName.Required"));
RuleFor(x => x.CardNumber).CreditCard().WithMessage(translationService.GetResource("Payment.CardNumber.Wrong"));
- RuleFor(x => x.CardCode).Matches(@"^[0-9]{3,4}$").WithMessage(translationService.GetResource("Payment.CardCode.Wrong"));
+ RuleFor(x => x.CardCode).Matches("^[0-9]{3,4}$").WithMessage(translationService.GetResource("Payment.CardCode.Wrong"));
RuleFor(x => x.ExpireMonth).NotEmpty().WithMessage(translationService.GetResource("Payment.ExpireMonth.Required"));
RuleFor(x => x.ExpireYear).NotEmpty().WithMessage(translationService.GetResource("Payment.ExpireYear.Required"));
}
diff --git a/src/Plugins/Shipping.FixedRateShipping/FixedRateShippingPlugin.cs b/src/Plugins/Shipping.FixedRateShipping/FixedRateShippingPlugin.cs
index 12cfde7b2..b3505dc11 100644
--- a/src/Plugins/Shipping.FixedRateShipping/FixedRateShippingPlugin.cs
+++ b/src/Plugins/Shipping.FixedRateShipping/FixedRateShippingPlugin.cs
@@ -24,12 +24,7 @@ namespace Shipping.FixedRateShipping
_languageService = languageService;
}
#endregion
-
- #region Utilities
-
-
- #endregion
-
+
#region Methods
/// <summary>
diff --git a/src/Plugins/Theme.Modern/Views/Modern/Account/AddressAdd.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Account/AddressAdd.cshtml
index 4e7f96518..28e65128e 100644
--- a/src/Plugins/Theme.Modern/Views/Modern/Account/AddressAdd.cshtml
+++ b/src/Plugins/Theme.Modern/Views/Modern/Account/AddressAdd.cshtml
@@ -28,8 +28,13 @@
</a>
<div asp-validation-summary="All" class="message-error"></div>
@{
- var dataDictAddress = new ViewDataDictionary(ViewData);
- dataDictAddress.TemplateInfo.HtmlFieldPrefix = "Address";
+ var dataDictAddress = new ViewDataDictionary(ViewData)
+ {
+ TemplateInfo =
+ {
+ HtmlFieldPrefix = "Address"
+ }
+ };
<partial name="Partials/CreateOrUpdateAddress" model="Model.Address" view-data="dataDictAddress" />
}
<vc:widget widget-zone="customer-address-add-form" additional-data="@Model"></vc:widget>
diff --git a/src/Plugins/Theme.Modern/Views/Modern/Account/AddressEdit.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Account/AddressEdit.cshtml
index 9d4ffc1cc..700e04bad 100644
--- a/src/Plugins/Theme.Modern/Views/Modern/Account/AddressEdit.cshtml
+++ b/src/Plugins/Theme.Modern/Views/Modern/Account/AddressEdit.cshtml
@@ -28,8 +28,13 @@
</a>
<div asp-validation-summary="All" class="message-error"></div>
@{
- var dataDictAddress = new ViewDataDictionary(ViewData);
- dataDictAddress.TemplateInfo.HtmlFieldPrefix = "Address";
+ var dataDictAddress = new ViewDataDictionary(ViewData)
+ {
+ TemplateInfo =
+ {
+ HtmlFieldPrefix = "Address"
+ }
+ };
<partial name="Partials/CreateOrUpdateAddress" model="Model.Address" view-data="dataDictAddress" />
}
<vc:widget widget-zone="customer-address-edit-form" additional-data="@Model"></vc:widget>
diff --git a/src/Plugins/Theme.Modern/Views/Modern/Account/Info.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Account/Info.cshtml
index 0ead69164..9faba4102 100644
--- a/src/Plugins/Theme.Modern/Views/Modern/Account/Info.cshtml
+++ b/src/Plugins/Theme.Modern/Views/Modern/Account/Info.cshtml
@@ -1,7 +1,6 @@
@model CustomerInfoModel
-@inject Grand.Domain.Customers.CustomerSettings customerSettings
+@inject CustomerSettings customerSettings
@inject IPageHeadBuilder pagebuilder
-@using Grand.Web.Models.Customer;
@{
Layout = "_TwoColumns";
@@ -171,9 +170,9 @@
control-year="@Html.IdFor(x => x.DateOfBirthYear)"
begin-year="@(DateTime.Now.Year - 100)"
end-year="DateTime.Now.Year"
- selected-day="Model.DateOfBirthDay.HasValue ? Model.DateOfBirthDay.Value : 0"
- selected-month="Model.DateOfBirthMonth.HasValue ? Model.DateOfBirthMonth.Value : 0"
- selected-year="Model.DateOfBirthYear.HasValue ? Model.DateOfBirthYear.Value : 0"
+ selected-day="Model.DateOfBirthDay ?? 0"
+ selected-month="Model.DateOfBirthMonth ?? 0"
+ selected-year="Model.DateOfBirthYear ?? 0"
class="col-12 input-group px-0" />
<span asp-validation-for="DateOfBirthDay"></span>
diff --git a/src/Plugins/Theme.Modern/Views/Modern/Account/Register.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Account/Register.cshtml
index d3a13cf51..128609b11 100644
--- a/src/Plugins/Theme.Modern/Views/Modern/Account/Register.cshtml
+++ b/src/Plugins/Theme.Modern/Views/Modern/Account/Register.cshtml
@@ -146,9 +146,9 @@
control-year="@Html.IdFor(x => x.DateOfBirthYear)"
begin-year="@(DateTime.Now.Year - 100)"
end-year="DateTime.Now.Year"
- selected-day="Model.DateOfBirthDay.HasValue ? Model.DateOfBirthDay.Value : 0"
- selected-month="Model.DateOfBirthMonth.HasValue ? Model.DateOfBirthMonth.Value : 0"
- selected-year="Model.DateOfBirthYear.HasValue ? Model.DateOfBirthYear.Value : 0"
+ selected-day="Model.DateOfBirthDay ?? 0"
+ selected-month="Model.DateOfBirthMonth ?? 0"
+ selected-year="Model.DateOfBirthYear ?? 0"
class="col-12 input-group px-0" />
</div>
<div class="row">
diff --git a/src/Plugins/Theme.Modern/Views/Modern/Order/Details.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Order/Details.cshtml
index 1942fe368..a8719bd17 100644
--- a/src/Plugins/Theme.Modern/Views/Modern/Order/Details.cshtml
+++ b/src/Plugins/Theme.Modern/Views/Modern/Order/Details.cshtml
@@ -21,8 +21,10 @@
{
<a @@click="$bvModal.show('ModalAddOrderNote')" class="btn btn-outline-secondary">@Loc["Order.AddOrderNote"]</a>
- var notemodel = new AddOrderNoteModel();
- notemodel.OrderId = Model.Id;
+ var notemodel = new AddOrderNoteModel
+ {
+ OrderId = Model.Id
+ };
<partial name="Partials/AddOrderNote" model="@notemodel" />
}
diff --git a/src/Plugins/Theme.Modern/Views/Modern/Product/Components/ProductReviews/Partials/ProductReview.Modal.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Product/Components/ProductReviews/Partials/ProductReview.Modal.cshtml
index c27de193f..5ec357360 100644
--- a/src/Plugins/Theme.Modern/Views/Modern/Product/Components/ProductReviews/Partials/ProductReview.Modal.cshtml
+++ b/src/Plugins/Theme.Modern/Views/Modern/Product/Components/ProductReviews/Partials/ProductReview.Modal.cshtml
@@ -1,7 +1,7 @@
@model ProductReviewsModel
@{
- var productlink = @Url.RouteUrl("Product", new { SeName = Model.ProductSeName });
+ var productlink = Url.RouteUrl("Product", new { SeName = Model.ProductSeName });
}
<b-modal id="ModalProductReview" ref="ModalProductReview" :dark-theme="darkMode" size="xl" @@shown="productreviews.modalReviewShown()" @@hide="productreviews.modalReviewClose()" centered hide-footer hide-header>
diff --git a/src/Plugins/Theme.Modern/Views/Modern/Product/Partials/AddToCart.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Product/Partials/AddToCart.cshtml
index c2c26a3a0..d2bf9d3d6 100644
--- a/src/Plugins/Theme.Modern/Views/Modern/Product/Partials/AddToCart.cshtml
+++ b/src/Plugins/Theme.Modern/Views/Modern/Product/Partials/AddToCart.cshtml
@@ -40,7 +40,7 @@
else
{
- var addId = "addtocart_" + @Model.ProductId + "_EnteredQuantity";
+ var addId = "addtocart_" + Model.ProductId + "_EnteredQuantity";
<label for="@addId" class="sr-only">@Loc["ShoppingCart.AddToCart"]</label>
<div class="qty-controls">
<div class="plus" onclick="increaseValue()"></div>
diff --git a/src/Plugins/Theme.Modern/Views/Modern/Product/ProductLayout.Grouped.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Product/ProductLayout.Grouped.cshtml
index 50c32da54..db46fa12c 100644
--- a/src/Plugins/Theme.Modern/Views/Modern/Product/ProductLayout.Grouped.cshtml
+++ b/src/Plugins/Theme.Modern/Views/Modern/Product/ProductLayout.Grouped.cshtml
@@ -184,8 +184,13 @@
<partial name="Partials/TierPrices" model="variant.TierPrices" />
}
@{
- var dataDictAddToCart = new ViewDataDictionary(ViewData);
- dataDictAddToCart.TemplateInfo.HtmlFieldPrefix = string.Format("addtocart_{0}", variant.Id);
+ var dataDictAddToCart = new ViewDataDictionary(ViewData)
+ {
+ TemplateInfo =
+ {
+ HtmlFieldPrefix = $"addtocart_{variant.Id}"
+ }
+ };
}
<!--price & add to cart-->
<partial name="Partials/Prices" model="variant.ProductPrice"/>
diff --git a/src/Plugins/Theme.Modern/Views/Modern/Product/ProductLayout.Simple.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Product/ProductLayout.Simple.cshtml
index ae76c13c6..941253522 100644
--- a/src/Plugins/Theme.Modern/Views/Modern/Product/ProductLayout.Simple.cshtml
+++ b/src/Plugins/Theme.Modern/Views/Modern/Product/ProductLayout.Simple.cshtml
@@ -125,8 +125,13 @@
<!--reservation info-->
@if (Model.ProductType == ProductType.Reservation)
{
- var dataDictReservation = new ViewDataDictionary(ViewData);
- dataDictReservation.TemplateInfo.HtmlFieldPrefix = string.Format("reservation_{0}", Model.Id);
+ var dataDictReservation = new ViewDataDictionary(ViewData)
+ {
+ TemplateInfo =
+ {
+ HtmlFieldPrefix = $"reservation_{Model.Id}"
+ }
+ };
<partial name="Partials/ReservationInfo" model="Model" view-data="dataDictReservation" />
}
<!--price & add to cart-->
@@ -139,8 +144,13 @@
}
<div class="col-lg-12 px-0">
@{
- var dataDictPrice = new ViewDataDictionary(ViewData);
- dataDictPrice.TemplateInfo.HtmlFieldPrefix = string.Format("price_{0}", Model.Id);
+ var dataDictPrice = new ViewDataDictionary(ViewData)
+ {
+ TemplateInfo =
+ {
+ HtmlFieldPrefix = $"price_{Model.Id}"
+ }
+ };
<partial name="Partials/Prices" model="Model.ProductPrice" view-data="dataDictPrice" />
}
</div>
@@ -148,15 +158,30 @@
<!--auction-->
@if (Model.ProductType == ProductType.Auction)
{
- var dataDictAuction = new ViewDataDictionary(ViewData);
- dataDictAuction.TemplateInfo.HtmlFieldPrefix = string.Format("auction_{0}", Model.Id);
+ var dataDictAuction = new ViewDataDictionary(ViewData)
+ {
+ TemplateInfo =
+ {
+ HtmlFieldPrefix = $"auction_{Model.Id}"
+ }
+ };
<partial name="Partials/AuctionInfo" model="Model" view-data="dataDictAuction" />
}
@{
- var dataDictAddToWishlist = new ViewDataDictionary(ViewData);
- dataDictAddToWishlist.TemplateInfo.HtmlFieldPrefix = string.Format("addtocart_{0}", Model.Id);
- var dataDictAddToCart = new ViewDataDictionary(ViewData);
- dataDictAddToCart.TemplateInfo.HtmlFieldPrefix = string.Format("addtocart_{0}", Model.Id);
+ var dataDictAddToWishlist = new ViewDataDictionary(ViewData)
+ {
+ TemplateInfo =
+ {
+ HtmlFieldPrefix = $"addtocart_{Model.Id}"
+ }
+ };
+ var dataDictAddToCart = new ViewDataDictionary(ViewData)
+ {
+ TemplateInfo =
+ {
+ HtmlFieldPrefix = $"addtocart_{Model.Id}"
+ }
+ };
}
<partial name="Partials/AddToCart" model="Model.AddToCart" view-data="dataDictAddToCart" />
<b-btn-group class="mt-2 mb-3 w-100 flex-wrap">
diff --git a/src/Plugins/Theme.Modern/Views/Modern/Shared/Components/PageBlock/Default.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Shared/Components/PageBlock/Default.cshtml
index 324aac027..606e48f13 100644
--- a/src/Plugins/Theme.Modern/Views/Modern/Shared/Components/PageBlock/Default.cshtml
+++ b/src/Plugins/Theme.Modern/Views/Modern/Shared/Components/PageBlock/Default.cshtml
@@ -46,7 +46,7 @@
@Loc["Page.EnterPassword"]
</div>
<div class="enter-password-form">
- @Html.Password("password", null, new { id = "password-" + @Model.Id, @class = "form-control mt-1" })
+ @Html.Password("password", null, new { id = "password-" + Model.Id, @class = "form-control mt-1" })
<b-button id="button-password" variant="secondary" class="page-password-button mt-1 mb-1">
@Loc["Page.Button"]
</b-button>
diff --git a/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/CatalogProductView.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/CatalogProductView.cshtml
index b3522f517..52e3c3347 100644
--- a/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/CatalogProductView.cshtml
+++ b/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/CatalogProductView.cshtml
@@ -242,7 +242,7 @@
<div class="list-button-container">
@if (Model.ShowQty)
{
- var qtyId = "addtocart_" + @Model.Id + "_EnteredQuantity";
+ var qtyId = "addtocart_" + Model.Id + "_EnteredQuantity";
<input class="form-control input-group-addon catalog-quantity" type="number" id="@qtyId" name="@qtyId" value="1">
}
@if (!Model.ProductPrice.DisableBuyButton)
diff --git a/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/CategoryLine.Menu.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/CategoryLine.Menu.cshtml
index cb7adcd0a..fe0f0b465 100644
--- a/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/CategoryLine.Menu.cshtml
+++ b/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/CategoryLine.Menu.cshtml
@@ -6,7 +6,7 @@
var galleryCheck = Model.Category.UserFields.FirstOrDefault(x => x.Key == "gallery")?.Value;
- <li class="@if (galleryCheck == "true") { <text>hasGallery</text> } @(Model.Category.SubCategories.Count() == 0 ? "category": "category -hasSubmenu" )">
+ <li class="@if (galleryCheck == "true") { <text>hasGallery</text> } @(Model.Category.SubCategories.Count == 0 ? "category": "category -hasSubmenu")">
<a href="@Url.RouteUrl("Category", new { Model.Category.SeName })">
@if (!string.IsNullOrEmpty(Model.Category.Icon))
diff --git a/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/ProductQuickView.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/ProductQuickView.cshtml
index b8542e863..40389a69f 100644
--- a/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/ProductQuickView.cshtml
+++ b/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/ProductQuickView.cshtml
@@ -1,6 +1,6 @@
@{
-var categoryLink = @Url.RouteUrl("Category");
-var productLink = @Url.RouteUrl("Product");
+var categoryLink = Url.RouteUrl("Category");
+var productLink = Url.RouteUrl("Product");
}
<b-modal id="ModalQuickView" ref="ModalQuickView" :dark-theme="darkMode" @@shown="initReservationQV(), QuickViewShown()" size="xl" centered hide-footer hide-header>
<template v-if="PopupQuickViewVueModal !== null">
diff --git a/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/QuickView/AddToCart.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/QuickView/AddToCart.cshtml
index 55223923f..1a9ae0463 100644
--- a/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/QuickView/AddToCart.cshtml
+++ b/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/QuickView/AddToCart.cshtml
@@ -1,6 +1,6 @@
@{
- var addtocart = @Url.RouteUrl("AddProductDetails");
- var updateitemcart = @Url.RouteUrl("UpdateItemCart");
+ var addtocart = Url.RouteUrl("AddProductDetails");
+ var updateitemcart = Url.RouteUrl("UpdateItemCart");
}
<template v-if="PopupQuickViewVueModal.AddToCart.UpdatedShoppingCartItemId !== null">
<input type="hidden" id="shoppingCartItemId" name="shoppingCartItemId" :value="UpdatedShoppingCartItemId" />
diff --git a/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/QuickView/AddToWishlist.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/QuickView/AddToWishlist.cshtml
index 3b9774de5..fc7443b7a 100644
--- a/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/QuickView/AddToWishlist.cshtml
+++ b/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/QuickView/AddToWishlist.cshtml
@@ -1,5 +1,5 @@
@{
- var addtowishlist = @Url.RouteUrl("AddProductDetails");
+ var addtowishlist = Url.RouteUrl("AddProductDetails");
}
<template v-if="!PopupQuickViewVueModal.AddToCart.DisableWishlistButton">
<template v-if="PopupQuickViewVueModal.AddToCart.UpdatedShoppingCartItemId == null">
diff --git a/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/QuickView/Attributes.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/QuickView/Attributes.cshtml
index 8300f7c2f..265640423 100644
--- a/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/QuickView/Attributes.cshtml
+++ b/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/QuickView/Attributes.cshtml
@@ -1,5 +1,5 @@
@{
- var fileLink = @Url.RouteUrl("UploadFileProductAttribute");
+ var fileLink = Url.RouteUrl("UploadFileProductAttribute");
}
<template id="product-attribute-quickview" asp-footer="true">
<tr>
diff --git a/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/QuickView/SendFriend.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/QuickView/SendFriend.cshtml
index b9ef1ad03..67ba76e22 100644
--- a/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/QuickView/SendFriend.cshtml
+++ b/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/QuickView/SendFriend.cshtml
@@ -1,5 +1,5 @@
@{
- var sendfriend = @Url.RouteUrl("ProductEmailAFriend");
+ var sendfriend = Url.RouteUrl("ProductEmailAFriend");
}
<template v-if="PopupQuickViewVueModal.EmailAFriendEnabled">
<a class="btn btn-outline-secondary email-a-friend-button mr-1" :href="'@sendfriend/' + PopupQuickViewVueModal.Id" v-b-tooltip.hover.bottom title="@Loc["Products.EmailAFriend"]">
diff --git a/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/QuickView/Warehouses.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/QuickView/Warehouses.cshtml
index 165d99ad5..2342551e4 100644
--- a/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/QuickView/Warehouses.cshtml
+++ b/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/QuickView/Warehouses.cshtml
@@ -1,5 +1,5 @@
@{
- var warehouseLink = @Url.Action("productdetails_warehousechange", "product");
+ var warehouseLink = Url.Action("productdetails_warehousechange", "product");
}
<template v-if="PopupQuickViewVueModal.AllowToSelectWarehouse">
<template v-if="PopupQuickViewVueModal.ProductWarehouses.length > 0">
diff --git a/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/SidebarShoppingCart.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/SidebarShoppingCart.cshtml
index a93e51882..90cfbbda9 100644
--- a/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/SidebarShoppingCart.cshtml
+++ b/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/SidebarShoppingCart.cshtml
@@ -18,7 +18,7 @@
<li>
<b-sidebar id="sidebar-cart" backdrop right text-variant="standard">
<template v-slot:title v-if="flycartindicator > 0">
- @Html.Raw(string.Format(Loc["ShoppingCart.Mini.ItemsText"], string.Format("<a href=\"{0}\">{1}</a>", Url.RouteUrl("ShoppingCart"), string.Format(Loc["ShoppingCart.Mini.Items"], "{{flycartindicator}}"))))
+ @Html.Raw(string.Format(Loc["ShoppingCart.Mini.ItemsText"], $"<a href=\"{Url.RouteUrl("ShoppingCart")}\">{string.Format(Loc["ShoppingCart.Mini.Items"], "{{flycartindicator}}")}</a>"))
</template>
<template v-slot:title v-else>
@Loc["ShoppingCart.Mini.NoItems"]
diff --git a/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/SidebarWishlist.cshtml b/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/SidebarWishlist.cshtml
index 09e9aa905..2e651e7f5 100644
--- a/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/SidebarWishlist.cshtml
+++ b/src/Plugins/Theme.Modern/Views/Modern/Shared/Partials/SidebarWishlist.cshtml
@@ -12,7 +12,7 @@
<li>
<b-sidebar id="sidebar-wishlist" backdrop right bg-variant="white" text-variant="standard">
<template v-slot:title v-if="wishindicator > 0">
- @Html.Raw(string.Format(Loc["Wishlist.Mini.ItemsText"], string.Format("<a href=\"{0}\">{1}</a>", Url.RouteUrl("Wishlist"), string.Format(Loc["Wishlist.Mini.Items"], "{{wishindicator}}"))))
+ @Html.Raw(string.Format(Loc["Wishlist.Mini.ItemsText"], $"<a href=\"{Url.RouteUrl("Wishlist")}\">{string.Format(Loc["Wishlist.Mini.Items"], "{{wishindicator}}")}</a>"))
</template>
<template v-slot:title v-else>
@Loc["Wishlist.Mini.NoItems"]
diff --git a/src/Plugins/Widgets.FacebookPixel/FacebookPixelPlugin.cs b/src/Plugins/Widgets.FacebookPixel/FacebookPixelPlugin.cs
index 0731e3d0e..b199a2b1f 100644
--- a/src/Plugins/Widgets.FacebookPixel/FacebookPixelPlugin.cs
+++ b/src/Plugins/Widgets.FacebookPixel/FacebookPixelPlugin.cs
@@ -52,8 +52,8 @@ namespace Widgets.FacebookPixel
src='https://www.facebook.com/tr?id={PIXELID}&ev=PageView&noscript=1'/>
</noscript>
<!-- End Facebook Pixel Code -->",
- AddToCartScript = @"<script> fbq('track', 'AddToCart', {contents: [{ id: '{PRODUCTID}', quantity: {QTY} }], content_name: '{PRODUCTNAME}', content_type: 'product', value: {AMOUNT}, currency: '{CURRENCY}'}); </script>",
- DetailsOrderScript = @"<script> fbq('track', 'Purchase', {currency: '{CURRENCY}', value: {AMOUNT}}); </script>",
+ AddToCartScript = "<script> fbq('track', 'AddToCart', {contents: [{ id: '{PRODUCTID}', quantity: {QTY} }], content_name: '{PRODUCTNAME}', content_type: 'product', value: {AMOUNT}, currency: '{CURRENCY}'}); </script>",
+ DetailsOrderScript = "<script> fbq('track', 'Purchase', {currency: '{CURRENCY}', value: {AMOUNT}}); </script>",
ConsentName = "Facebook pixel",
ConsentDescription = "Allows us to identifies visitors from Facebook"
};
diff --git a/src/Plugins/Widgets.GoogleAnalytics/Areas/Admin/Views/WidgetsGoogleAnalytics/Configure.cshtml b/src/Plugins/Widgets.GoogleAnalytics/Areas/Admin/Views/WidgetsGoogleAnalytics/Configure.cshtml
index 36f9a4936..a302d77b1 100644
--- a/src/Plugins/Widgets.GoogleAnalytics/Areas/Admin/Views/WidgetsGoogleAnalytics/Configure.cshtml
+++ b/src/Plugins/Widgets.GoogleAnalytics/Areas/Admin/Views/WidgetsGoogleAnalytics/Configure.cshtml
@@ -16,8 +16,8 @@
{ECOMMERCE}
</script>
"));
- var googleAnalytics_EcommerceScript = Html.Raw(System.Text.Encodings.Web.JavaScriptEncoder.Default.Encode(@"gtag('event', 'purchase', {transaction_id: '{ORDERID}', value: {TOTAL}, tax: {TAX}, shipping: {SHIP}, currency: '{CURRENCY}', city: '{CITY}', state: '{STATEPROVINCE}', country: '{COUNTRY}', items: [{DETAILS}]});"));
- var googleAnalytics_EcommerceDetailScript = Html.Raw(System.Text.Encodings.Web.JavaScriptEncoder.Default.Encode(@"{ item_id: '{PRODUCTID}', item_name: '{PRODUCTNAME}', item_category: '{CATEGORYNAME}', price: {UNITPRICE}, quantity: {QUANTITY} }, "));
+ var googleAnalytics_EcommerceScript = Html.Raw(System.Text.Encodings.Web.JavaScriptEncoder.Default.Encode("gtag('event', 'purchase', {transaction_id: '{ORDERID}', value: {TOTAL}, tax: {TAX}, shipping: {SHIP}, currency: '{CURRENCY}', city: '{CITY}', state: '{STATEPROVINCE}', country: '{COUNTRY}', items: [{DETAILS}]});"));
+ var googleAnalytics_EcommerceDetailScript = Html.Raw(System.Text.Encodings.Web.JavaScriptEncoder.Default.Encode("{ item_id: '{PRODUCTID}', item_name: '{PRODUCTNAME}', item_category: '{CATEGORYNAME}', price: {UNITPRICE}, quantity: {QUANTITY} }, "));
}
<script>
diff --git a/src/Plugins/Widgets.GoogleAnalytics/GoogleAnalyticPlugin.cs b/src/Plugins/Widgets.GoogleAnalytics/GoogleAnalyticPlugin.cs
index 8ed08746b..197034f72 100644
--- a/src/Plugins/Widgets.GoogleAnalytics/GoogleAnalyticPlugin.cs
+++ b/src/Plugins/Widgets.GoogleAnalytics/GoogleAnalyticPlugin.cs
@@ -47,8 +47,8 @@ namespace Widgets.GoogleAnalytics
{ECOMMERCE}
</script>
",
- EcommerceScript = @"gtag('event', 'purchase', {transaction_id: '{ORDERID}', value: {TOTAL}, tax: {TAX}, shipping: {SHIP}, currency: '{CURRENCY}', city: '{CITY}', state: '{STATEPROVINCE}', country: '{COUNTRY}', items: [{DETAILS}]});",
- EcommerceDetailScript = @"{ item_id: '{PRODUCTID}', item_name: '{PRODUCTNAME}', item_category: '{CATEGORYNAME}', price: {UNITPRICE}, quantity: {QUANTITY} }, ",
+ EcommerceScript = "gtag('event', 'purchase', {transaction_id: '{ORDERID}', value: {TOTAL}, tax: {TAX}, shipping: {SHIP}, currency: '{CURRENCY}', city: '{CITY}', state: '{STATEPROVINCE}', country: '{COUNTRY}', items: [{DETAILS}]});",
+ EcommerceDetailScript = "{ item_id: '{PRODUCTID}', item_name: '{PRODUCTNAME}', item_category: '{CATEGORYNAME}', price: {UNITPRICE}, quantity: {QUANTITY} }, ",
ConsentName = "Google Analytics",
ConsentDescription = "Allows us to analyse the statistics of visits to our website."
};
diff --git a/src/Tests/Grand.Business.Authentication.Tests/Services/CookieAuthenticationServiceTests.cs b/src/Tests/Grand.Business.Authentication.Tests/Services/CookieAuthenticationServiceTests.cs
index d525555e0..17a28aed9 100644
--- a/src/Tests/Grand.Business.Authentication.Tests/Services/CookieAuthenticationServiceTests.cs
+++ b/src/Tests/Grand.Business.Authentication.Tests/Services/CookieAuthenticationServiceTests.cs
@@ -35,9 +35,10 @@ namespace Grand.Business.Authentication.Tests.Services
_customerSettings = new CustomerSettings();
_groupServiceMock = new Mock<IGroupService>();
_userFieldServiceMock = new Mock<IUserFieldService>();
- _config = new SecurityConfig();
- _config.CookieClaimsIssuer = "grandnode";
- _config.CookiePrefix = ".Grand.";
+ _config = new SecurityConfig {
+ CookieClaimsIssuer = "grandnode",
+ CookiePrefix = ".Grand."
+ };
_cookieAuthService = new CookieAuthenticationService(_customerSettings, _customerServiceMock.Object, _groupServiceMock.Object, _userFieldServiceMock.Object, _httpAccessorMock.Object, _config);
//For mock HttpContext extension methods like SignOutAsync ,SignInAsync etc..
_authServiceMock = new Mock<IAuthenticationService>();
diff --git a/src/Tests/Grand.Business.Authentication.Tests/Services/ExternalAuthenticationServiceTests.cs b/src/Tests/Grand.Business.Authentication.Tests/Services/ExternalAuthenticationServiceTests.cs
index dfef5a736..f9f21446c 100644
--- a/src/Tests/Grand.Business.Authentication.Tests/Services/ExternalAuthenticationServiceTests.cs
+++ b/src/Tests/Grand.Business.Authentication.Tests/Services/ExternalAuthenticationServiceTests.cs
@@ -39,10 +39,12 @@ namespace Grand.Business.Authentication.Tests.Services
_workContextMock = new Mock<IWorkContext>();
_externalAuthenticationProviders = new List<IExternalAuthenticationProvider> { new ExternalAuthenticationProviderTest() };
- var externalAuthenticationSetting = new ExternalAuthenticationSettings();
- externalAuthenticationSetting.ActiveAuthenticationMethodSystemNames = [
- "ExternalAuthenticationProviderTest"
- ];
+ var externalAuthenticationSetting = new ExternalAuthenticationSettings
+ {
+ ActiveAuthenticationMethodSystemNames = [
+ "ExternalAuthenticationProviderTest"
+ ]
+ };
_externalAuthenticationService = new ExternalAuthenticationService(_authenticationServiceMock.Object, _customerManagerServiceMock.Object, _customerServiceMock.Object,
_groupServiceMock.Object, _mediatorMock.Object, _externalAuthenticationRecordRepository, _workContextMock.Object, _externalAuthenticationProviders,
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/BrandDeletedEventHandlerTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/BrandDeletedEventHandlerTests.cs
index 5073ce575..765107892 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/BrandDeletedEventHandlerTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/BrandDeletedEventHandlerTests.cs
@@ -24,14 +24,17 @@ namespace Grand.Business.Catalog.Tests.Events.Handlers
{
//Arrange
var brand = new Brand();
- var product = new Product();
- product.BrandId = brand.Id;
+ var product = new Product {
+ BrandId = brand.Id
+ };
await _repository.InsertAsync(product);
- var product2 = new Product();
- product2.BrandId = brand.Id;
+ var product2 = new Product {
+ BrandId = brand.Id
+ };
await _repository.InsertAsync(product2);
- var product3 = new Product();
- product3.BrandId = "1";
+ var product3 = new Product {
+ BrandId = "1"
+ };
await _repository.InsertAsync(product3);
//Act
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/DeleteMeasureUnitOnProductEventHandlerTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/DeleteMeasureUnitOnProductEventHandlerTests.cs
index e584b0794..0d672dbca 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/DeleteMeasureUnitOnProductEventHandlerTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/DeleteMeasureUnitOnProductEventHandlerTests.cs
@@ -25,14 +25,17 @@ namespace Grand.Business.Catalog.Tests.Events.Handlers
{
//Arrange
var measureUnit = new MeasureUnit();
- var product = new Product();
- product.UnitId = measureUnit.Id;
+ var product = new Product {
+ UnitId = measureUnit.Id
+ };
await _repository.InsertAsync(product);
- var product2 = new Product();
- product2.UnitId = measureUnit.Id;
+ var product2 = new Product {
+ UnitId = measureUnit.Id
+ };
await _repository.InsertAsync(product2);
- var product3 = new Product();
- product3.UnitId = "1";
+ var product3 = new Product {
+ UnitId = "1"
+ };
await _repository.InsertAsync(product3);
//Act
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/DeliveryDateDeletedEventHandlerTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/DeliveryDateDeletedEventHandlerTests.cs
index d40c2baba..31234afc7 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/DeliveryDateDeletedEventHandlerTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/DeliveryDateDeletedEventHandlerTests.cs
@@ -25,14 +25,17 @@ namespace Grand.Business.Catalog.Tests.Events.Handlers
{
//Arrange
var deliveryDate = new DeliveryDate();
- var product = new Product();
- product.DeliveryDateId = deliveryDate.Id;
+ var product = new Product {
+ DeliveryDateId = deliveryDate.Id
+ };
await _repository.InsertAsync(product);
- var product2 = new Product();
- product2.DeliveryDateId = deliveryDate.Id;
+ var product2 = new Product {
+ DeliveryDateId = deliveryDate.Id
+ };
await _repository.InsertAsync(product2);
- var product3 = new Product();
- product3.DeliveryDateId = "1";
+ var product3 = new Product {
+ DeliveryDateId = "1"
+ };
await _repository.InsertAsync(product3);
//Act
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/TaxCategoryDeletedEventHandlerTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/TaxCategoryDeletedEventHandlerTests.cs
index a11fccaed..138c5c0a3 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/TaxCategoryDeletedEventHandlerTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/TaxCategoryDeletedEventHandlerTests.cs
@@ -25,14 +25,17 @@ namespace Grand.Business.Catalog.Tests.Events.Handlers
{
//Arrange
var taxCategory = new TaxCategory();
- var product = new Product();
- product.TaxCategoryId = taxCategory.Id;
+ var product = new Product {
+ TaxCategoryId = taxCategory.Id
+ };
await _repository.InsertAsync(product);
- var product2 = new Product();
- product2.TaxCategoryId = taxCategory.Id;
+ var product2 = new Product {
+ TaxCategoryId = taxCategory.Id
+ };
await _repository.InsertAsync(product2);
- var product3 = new Product();
- product3.TaxCategoryId = "1";
+ var product3 = new Product {
+ TaxCategoryId = "1"
+ };
await _repository.InsertAsync(product3);
//Act
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/WarehouseDeletedEventHandlerTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/WarehouseDeletedEventHandlerTests.cs
index b53f474fd..1637722cc 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/WarehouseDeletedEventHandlerTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Events/Handlers/WarehouseDeletedEventHandlerTests.cs
@@ -25,14 +25,17 @@ namespace Grand.Business.Catalog.Tests.Events.Handlers
{
//Arrange
var warehouse = new Warehouse();
- var product = new Product();
- product.WarehouseId = warehouse.Id;
+ var product = new Product {
+ WarehouseId = warehouse.Id
+ };
await _repository.InsertAsync(product);
- var product2 = new Product();
- product2.WarehouseId = warehouse.Id;
+ var product2 = new Product {
+ WarehouseId = warehouse.Id
+ };
await _repository.InsertAsync(product2);
- var product3 = new Product();
- product3.WarehouseId = "1";
+ var product3 = new Product {
+ WarehouseId = "1"
+ };
await _repository.InsertAsync(product3);
//Act
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetRecommendedProductsQueryHandlerTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetRecommendedProductsQueryHandlerTests.cs
index 9acd8d932..1b7d9016e 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetRecommendedProductsQueryHandlerTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetRecommendedProductsQueryHandlerTests.cs
@@ -31,9 +31,11 @@ namespace Grand.Business.Catalog.Tests.Queries.Handlers
[TestMethod()]
public async Task HandleTest()
{
- var getRecommendedProductsQuery = new Core.Queries.Catalog.GetRecommendedProductsQuery();
- getRecommendedProductsQuery.CustomerGroupIds = ["1"];
- getRecommendedProductsQuery.StoreId = "1";
+ var getRecommendedProductsQuery = new Core.Queries.Catalog.GetRecommendedProductsQuery
+ {
+ CustomerGroupIds = ["1"],
+ StoreId = "1"
+ };
await handler.Handle(getRecommendedProductsQuery, CancellationToken.None);
_casheManagerMock.Verify(c => c.GetAsync(It.IsAny<string>(), It.IsAny<Func<Task<List<Product>>>>()), Times.Once);
}
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetSearchProductsQueryHandlerTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetSearchProductsQueryHandlerTests.cs
index 99c22cf63..59160ff88 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetSearchProductsQueryHandlerTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetSearchProductsQueryHandlerTests.cs
@@ -27,8 +27,9 @@ namespace Grand.Business.Catalog.Tests.Queries.Handlers
{
//Arrange
await _repository.InsertAsync(new Product { Published = true, VisibleIndividually = true });
- var searchProductsQuery = new Core.Queries.Catalog.GetSearchProductsQuery();
- searchProductsQuery.Customer = new Domain.Customers.Customer();
+ var searchProductsQuery = new Core.Queries.Catalog.GetSearchProductsQuery {
+ Customer = new Domain.Customers.Customer()
+ };
//Act
var result = await handler.Handle(searchProductsQuery, CancellationToken.None);
//Arrange
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetSuggestedProductsQueryHandlerTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetSuggestedProductsQueryHandlerTests.cs
index a21e5bd96..1b6086b71 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetSuggestedProductsQueryHandlerTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Queries/Handlers/GetSuggestedProductsQueryHandlerTests.cs
@@ -31,9 +31,10 @@ namespace Grand.Business.Catalog.Tests.Queries.Handlers
[TestMethod()]
public async Task HandleTest()
{
- var suggestedProductsQuery = new Core.Queries.Catalog.GetSuggestedProductsQuery();
- suggestedProductsQuery.CustomerTagIds = ["1"];
- suggestedProductsQuery.ProductsNumber = 10;
+ var suggestedProductsQuery = new Core.Queries.Catalog.GetSuggestedProductsQuery {
+ CustomerTagIds = ["1"],
+ ProductsNumber = 10
+ };
await handler.Handle(suggestedProductsQuery, CancellationToken.None);
_casheManagerMock.Verify(c => c.GetAsync(It.IsAny<string>(), It.IsAny<Func<Task<List<Product>>>>()), Times.Once);
}
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Brands/BrandServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Brands/BrandServiceTests.cs
index d264a4e2d..4f3b1bb00 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Brands/BrandServiceTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Brands/BrandServiceTests.cs
@@ -137,7 +137,7 @@ namespace Grand.Business.Catalog.Tests.Services.Brands
//Assert
Assert.IsNotNull(result);
- Assert.AreEqual(1, result.Count());
+ Assert.AreEqual(1, result.Count);
}
}
}
\ No newline at end of file
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Discounts/DiscountServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Discounts/DiscountServiceTests.cs
index 474da225e..37a366b35 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Discounts/DiscountServiceTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Discounts/DiscountServiceTests.cs
@@ -95,7 +95,7 @@ namespace Grand.Business.Catalog.Tests.Services.Discounts
//Assert
Assert.IsNotNull(result);
- Assert.AreEqual(2, result.Count());
+ Assert.AreEqual(2, result.Count);
}
[TestMethod()]
@@ -605,7 +605,7 @@ namespace Grand.Business.Catalog.Tests.Services.Discounts
var usageHistory = await _dicountService.GetAllDiscountUsageHistory();
//Assert
- Assert.AreEqual(2, usageHistory.Count());
+ Assert.AreEqual(2, usageHistory.Count);
}
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Prices/PriceServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Prices/PriceServiceTests.cs
index 611bc0ffb..7c24b319e 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Prices/PriceServiceTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Prices/PriceServiceTests.cs
@@ -80,9 +80,10 @@ namespace Grand.Business.Catalog.Tests.Services.Prices
var eventPublisher = new Mock<IMediator>();
_eventPublisher = eventPublisher.Object;
- _currencySettings = new CurrencySettings();
- _currencySettings.PrimaryExchangeRateCurrencyId = "1";
- _currencySettings.PrimaryStoreCurrencyId = "1";
+ _currencySettings = new CurrencySettings {
+ PrimaryExchangeRateCurrencyId = "1",
+ PrimaryStoreCurrencyId = "1"
+ };
//_currencyService = new Mock<ICurrencyService>().Object;
_currency = new Currency { Id = "1", CurrencyCode = "USD", Rate = 1, Published = true, MidpointRoundId = System.MidpointRounding.ToEven, RoundingTypeId = RoundingType.Rounding001 };
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductReviewServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductReviewServiceTests.cs
index 4e0149d13..ccd54c12c 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductReviewServiceTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductReviewServiceTests.cs
@@ -38,7 +38,7 @@ namespace Grand.Business.Catalog.Tests.Services.Products
var result = await _productReviewService.GetAllProductReviews("1", null);
//Assert
- Assert.AreEqual(2, result.Count());
+ Assert.AreEqual(2, result.Count);
}
[TestMethod()]
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductTagServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductTagServiceTests.cs
index 2c69df054..e41c6479f 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductTagServiceTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Products/ProductTagServiceTests.cs
@@ -101,8 +101,9 @@ namespace Grand.Business.Catalog.Tests.Services.Products
public async Task InsertProductTagTest()
{
//Arrange
- var productTag = new ProductTag();
- productTag.Name = "test";
+ var productTag = new ProductTag {
+ Name = "test"
+ };
//Act
await _productTagService.InsertProductTag(productTag);
var result = await _productTagService.GetProductTagById(productTag.Id);
@@ -115,8 +116,9 @@ namespace Grand.Business.Catalog.Tests.Services.Products
public async Task UpdateProductTagTest()
{
//Arrange
- var productTag = new ProductTag();
- productTag.Name = "test";
+ var productTag = new ProductTag {
+ Name = "test"
+ };
await _productTagService.InsertProductTag(productTag);
//Act
productTag.Name = "test2";
@@ -131,8 +133,9 @@ namespace Grand.Business.Catalog.Tests.Services.Products
public async Task DeleteProductTagTest()
{
//Arrange
- var productTag = new ProductTag();
- productTag.Name = "test";
+ var productTag = new ProductTag {
+ Name = "test"
+ };
await _productTagService.InsertProductTag(productTag);
//Act
@@ -147,8 +150,9 @@ namespace Grand.Business.Catalog.Tests.Services.Products
public async Task AttachProductTagTest()
{
//Arrange
- var productTag = new ProductTag();
- productTag.Name = "test";
+ var productTag = new ProductTag {
+ Name = "test"
+ };
await _productTagService.InsertProductTag(productTag);
var product = new Product();
await _productRepository.InsertAsync(product);
@@ -166,8 +170,9 @@ namespace Grand.Business.Catalog.Tests.Services.Products
public async Task DetachProductTagTest()
{
//Arrange
- var productTag = new ProductTag();
- productTag.Name = "test";
+ var productTag = new ProductTag {
+ Name = "test"
+ };
await _productTagService.InsertProductTag(productTag);
var product = new Product();
await _productRepository.InsertAsync(product);
@@ -186,9 +191,10 @@ namespace Grand.Business.Catalog.Tests.Services.Products
public async Task GetProductCountTest()
{
//Arrange
- var productTag = new ProductTag();
- productTag.Name = "test";
- productTag.Count = 10;
+ var productTag = new ProductTag {
+ Name = "test",
+ Count = 10
+ };
await _productTagService.InsertProductTag(productTag);
//Act
var result = await _productTagService.GetProductCount(productTag.Id, "");
diff --git a/src/Tests/Grand.Business.Catalog.Tests/Services/Tax/TaxServiceTests.cs b/src/Tests/Grand.Business.Catalog.Tests/Services/Tax/TaxServiceTests.cs
index 00586db8b..149ce31b0 100644
--- a/src/Tests/Grand.Business.Catalog.Tests/Services/Tax/TaxServiceTests.cs
+++ b/src/Tests/Grand.Business.Catalog.Tests/Services/Tax/TaxServiceTests.cs
@@ -40,8 +40,9 @@ namespace Grand.Business.Catalog.Tests.Services.Tax
serviceProvider.Setup(x => x.GetService(typeof(FixedRateTestTaxProvider))).Returns(new FixedRateTestTaxProvider());
_serviceProvider = serviceProvider.Object;
- _taxProviderSettings = new TaxProviderSettings();
- _taxProviderSettings.ActiveTaxProviderSystemName = "test-provider";
+ _taxProviderSettings = new TaxProviderSettings {
+ ActiveTaxProviderSystemName = "test-provider"
+ };
_taxSettings = new TaxSettings();
_workContext = null;
@@ -64,8 +65,9 @@ namespace Grand.Business.Catalog.Tests.Services.Tax
public async Task Can_check_taxExempt_product()
{
- var product = new Product();
- product.IsTaxExempt = true;
+ var product = new Product {
+ IsTaxExempt = true
+ };
Assert.IsTrue(await _taxService.IsTaxExempt(product, null));
product.IsTaxExempt = false;
Assert.IsFalse(await _taxService.IsTaxExempt(product, null));
@@ -140,10 +142,12 @@ namespace Grand.Business.Catalog.Tests.Services.Tax
[TestMethod()]
public async Task GetProductPriceQuickly_NonTaxExemptAndPriceIncludingTax_ShouldReturnTheSameValues()
{
- var product = new Product();
- product.IsTaxExempt = false;
- var customer = new Customer();
- customer.IsTaxExempt = false;
+ var product = new Product {
+ IsTaxExempt = false
+ };
+ var customer = new Customer {
+ IsTaxExempt = false
+ };
var taxCategoryId = ""; //as in code
var scUnitPriceWithoutDiscount = 1000.00;
@@ -172,12 +176,14 @@ namespace Grand.Business.Catalog.Tests.Services.Tax
[TestMethod()]
public async Task GetProductPriceQuickly_NonTaxExemptAndPriceExcludingTax_ShouldReturnTheSameValues()
{
- var product = new Product();
- product.TaxCategoryId = "";
- product.IsTele = false;
- product.IsTaxExempt = false;
- var customer = new Customer();
- customer.IsTaxExempt = false;
+ var product = new Product {
+ TaxCategoryId = "",
+ IsTele = false,
+ IsTaxExempt = false
+ };
+ var customer = new Customer {
+ IsTaxExempt = false
+ };
var taxCategoryId = ""; //as in code
_groupServiceMock.Setup(c => c.GetAllByIds(It.IsAny<string[]>())).Returns(Task.FromResult<IList<CustomerGroup>>(new List<CustomerGroup>()));
var scUnitPriceWithoutDiscount = 1000.00;
@@ -205,12 +211,14 @@ namespace Grand.Business.Catalog.Tests.Services.Tax
[TestMethod()]
public async Task GetProductPriceQuickly_TaxExemptAndPriceIncludingTax_ShouldReturnTheSameValues()
{
- var product = new Product();
- product.TaxCategoryId = "57516fc81b0dc92b20fdd2ef";
- product.IsTele = false;
- product.IsTaxExempt = true;
- var customer = new Customer();
- customer.IsTaxExempt = true;
+ var product = new Product {
+ TaxCategoryId = "57516fc81b0dc92b20fdd2ef",
+ IsTele = false,
+ IsTaxExempt = true
+ };
+ var customer = new Customer {
+ IsTaxExempt = true
+ };
var taxCategoryId = "";
var scUnitPriceWithoutDiscount = 1000.00;
@@ -238,12 +246,14 @@ namespace Grand.Business.Catalog.Tests.Services.Tax
[TestMethod()]
public async Task GetProductPriceQuickly_TaxExemptAndPriceExcludingTax_ShouldReturnTheSameValues()
{
- var product = new Product();
- product.TaxCategoryId = "57516fc81b0dc92b20fdd2ef";
- product.IsTele = false;
- product.IsTaxExempt = true;
- var customer = new Customer();
- customer.IsTaxExempt = true;
+ var product = new Product {
+ TaxCategoryId = "57516fc81b0dc92b20fdd2ef",
+ IsTele = false,
+ IsTaxExempt = true
+ };
+ var customer = new Customer {
+ IsTaxExempt = true
+ };
var taxCategoryId = "";
var scUnitPriceWithoutDiscount = 1000.00;
diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/AddCustomerReservationCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/AddCustomerReservationCommandHandlerTests.cs
index 7d05eb46d..e5a9cc988 100644
--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/AddCustomerReservationCommandHandlerTests.cs
+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/AddCustomerReservationCommandHandlerTests.cs
@@ -24,15 +24,16 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orders
public async Task HandleTest()
{
//Arrange
- var command = new Core.Commands.Checkout.Orders.AddCustomerReservationCommand();
- command.Customer = new Domain.Customers.Customer();
- command.RentalStartDate = DateTime.UtcNow.AddDays(1).Date;
- command.RentalEndDate = DateTime.UtcNow.AddDays(2).Date;
- command.Product = new Domain.Catalog.Product {
- IncBothDate = true,
- IntervalUnitId = IntervalUnit.Day
+ var command = new Core.Commands.Checkout.Orders.AddCustomerReservationCommand {
+ Customer = new Domain.Customers.Customer(),
+ RentalStartDate = DateTime.UtcNow.AddDays(1).Date,
+ RentalEndDate = DateTime.UtcNow.AddDays(2).Date,
+ Product = new Domain.Catalog.Product {
+ IncBothDate = true,
+ IntervalUnitId = IntervalUnit.Day
+ },
+ ShoppingCartItem = new Domain.Orders.ShoppingCartItem { }
};
- command.ShoppingCartItem = new Domain.Orders.ShoppingCartItem { };
_productReservationServiceMock.Setup(c => c.GetProductReservationsByProductId(It.IsAny<string>(), true, null, 0, int.MaxValue)).Returns(() => Task.FromResult((IPagedList<ProductReservation>)
new PagedList<ProductReservation> {
diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/AddRequiredProductsCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/AddRequiredProductsCommandHandlerTests.cs
index d61349f14..cd2c40e3d 100644
--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/AddRequiredProductsCommandHandlerTests.cs
+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/AddRequiredProductsCommandHandlerTests.cs
@@ -32,8 +32,9 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orders
public async Task HandleTest()
{
//Arrange
- var command = new Core.Commands.Checkout.Orders.AddRequiredProductsCommand();
- command.Customer = new Domain.Customers.Customer();
+ var command = new Core.Commands.Checkout.Orders.AddRequiredProductsCommand {
+ Customer = new Domain.Customers.Customer()
+ };
command.Customer.ShoppingCartItems.Add(new ShoppingCartItem { ProductId = "1", ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "" });
command.Product = new Domain.Catalog.Product { Id = "1", RequireOtherProducts = true, RequiredProductIds = "2,3", AutoAddRequiredProducts = true };
command.ShoppingCartType = ShoppingCartType.ShoppingCart;
diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/AwardLoyaltyPointsCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/AwardLoyaltyPointsCommandHandlerTests.cs
index 22c5926e1..f360afb5c 100644
--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/AwardLoyaltyPointsCommandHandlerTests.cs
+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/AwardLoyaltyPointsCommandHandlerTests.cs
@@ -42,8 +42,9 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orders
public async Task HandleTest()
{
//Arrange
- var command = new AwardLoyaltyPointsCommand();
- command.Order = new Domain.Orders.Order { StoreId = "", OrderNumber = 1 };
+ var command = new AwardLoyaltyPointsCommand {
+ Order = new Domain.Orders.Order { StoreId = "", OrderNumber = 1 }
+ };
var expectedCustomer = new Customer { Username = "John", Active = true };
_customerServiceMock.Setup(c => c.GetCustomerById(It.IsAny<string>())).Returns(() => Task.FromResult(expectedCustomer));
_currencyServiceMock.Setup(c => c.GetCurrencyByCode(It.IsAny<string>())).Returns(() => Task.FromResult(new Domain.Directory.Currency()));
diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CancelOrderCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CancelOrderCommandHandlerTests.cs
index 791e8ab0f..50d24ffea 100644
--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CancelOrderCommandHandlerTests.cs
+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CancelOrderCommandHandlerTests.cs
@@ -49,25 +49,28 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orders
[TestMethod]
public void Handle_OrderNull_ThrowException()
{
- var command = new CancelOrderCommand();
- command.Order = null;
+ var command = new CancelOrderCommand {
+ Order = null
+ };
Assert.ThrowsExceptionAsync<ArgumentNullException>(async () => await _handler.Handle(command, default));
}
[TestMethod]
public void Handle_AlreadyCancelled_ThrowException()
{
- var command = new CancelOrderCommand();
- command.Order = new Order { OrderStatusId = (int)OrderStatusSystem.Cancelled };
+ var command = new CancelOrderCommand {
+ Order = new Order { OrderStatusId = (int)OrderStatusSystem.Cancelled }
+ };
Assert.ThrowsExceptionAsync<Exception>(async () => await _handler.Handle(command, default));
}
[TestMethod]
public async Task Handle_InvokeExpectedMethods()
{
- var command = new CancelOrderCommand();
- command.Order = new Order {
- Id = "id"
+ var command = new CancelOrderCommand {
+ Order = new Order {
+ Id = "id"
+ }
};
_shipmentServiceMock.Setup(c => c.GetShipmentsByOrder("id")).ReturnsAsync(new List<Shipment>());
await _handler.Handle(command, default);
diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CancelOrderItemCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CancelOrderItemCommandHandlerTests.cs
index 4c9cac1d9..96f6a95ca 100644
--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CancelOrderItemCommandHandlerTests.cs
+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CancelOrderItemCommandHandlerTests.cs
@@ -39,11 +39,12 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orders
[TestMethod()]
public async Task HandleTest()
{
- var command = new CancelOrderItemCommand();
- command.Order = new Order {
- Id = "id"
+ var command = new CancelOrderItemCommand {
+ Order = new Order {
+ Id = "id"
+ },
+ OrderItem = new OrderItem { OpenQty = 1, Status = OrderItemStatus.Open }
};
- command.OrderItem = new OrderItem { OpenQty = 1, Status = OrderItemStatus.Open };
_shipmentServiceMock.Setup(c => c.GetShipmentsByOrder(It.IsAny<string>())).ReturnsAsync(new List<Shipment>());
_productServiceMock.Setup(a => a.GetProductById(It.IsAny<string>(), false)).Returns(() => Task.FromResult(new Product { Id = "2", Published = true, Price = 10 }));
diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CheckOrderStatusCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CheckOrderStatusCommandHandlerTests.cs
index d581a5da5..55da5a466 100644
--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CheckOrderStatusCommandHandlerTests.cs
+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/CheckOrderStatusCommandHandlerTests.cs
@@ -29,11 +29,13 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orders
[TestMethod]
public async Task Handle_InvokeExpectedMethods()
{
- var request = new CheckOrderStatusCommand();
- request.Order = new Order();
- request.Order.PaymentStatusId = PaymentStatus.Paid;
- request.Order.PaidDateUtc = null;
- request.Order.OrderStatusId = (int)OrderStatusSystem.Pending;
+ var request = new CheckOrderStatusCommand {
+ Order = new Order {
+ PaymentStatusId = PaymentStatus.Paid,
+ PaidDateUtc = null,
+ OrderStatusId = (int)OrderStatusSystem.Pending
+ }
+ };
await _handler.Handle(request, default);
diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ReduceLoyaltyPointsCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ReduceLoyaltyPointsCommandHandlerTests.cs
index 90bca70b3..572044984 100644
--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ReduceLoyaltyPointsCommandHandlerTests.cs
+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ReduceLoyaltyPointsCommandHandlerTests.cs
@@ -42,8 +42,9 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orders
public async Task HandleTest()
{
//Arrange
- var command = new ReduceLoyaltyPointsCommand();
- command.Order = new Domain.Orders.Order { StoreId = "", OrderNumber = 1, CalcLoyaltyPoints = 100 };
+ var command = new ReduceLoyaltyPointsCommand {
+ Order = new Domain.Orders.Order { StoreId = "", OrderNumber = 1, CalcLoyaltyPoints = 100 }
+ };
var expectedCustomer = new Customer { Username = "John", Active = true };
_customerServiceMock.Setup(c => c.GetCustomerById(It.IsAny<string>())).Returns(() => Task.FromResult(expectedCustomer));
_currencyServiceMock.Setup(c => c.GetCurrencyByCode(It.IsAny<string>())).Returns(() => Task.FromResult(new Domain.Directory.Currency()));
diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ReturnBackRedeemedLoyaltyPointsCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ReturnBackRedeemedLoyaltyPointsCommandHandlerTests.cs
index c9425206c..90632a099 100644
--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ReturnBackRedeemedLoyaltyPointsCommandHandlerTests.cs
+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ReturnBackRedeemedLoyaltyPointsCommandHandlerTests.cs
@@ -24,8 +24,9 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orders
public async Task HandleTest()
{
//Arrange
- var command = new Core.Commands.Checkout.Orders.ReturnBackRedeemedLoyaltyPointsCommand();
- command.Order = new Domain.Orders.Order { RedeemedLoyaltyPoints = 10 };
+ var command = new Core.Commands.Checkout.Orders.ReturnBackRedeemedLoyaltyPointsCommand {
+ Order = new Domain.Orders.Order { RedeemedLoyaltyPoints = 10 }
+ };
_translationServiceMock.Setup(x => x.GetResource(It.IsAny<string>())).Returns("Name");
//Act
await _handler.Handle(command, CancellationToken.None);
diff --git a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ValidateMinShoppingCartSubtotalAmountCommandHandlerTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ValidateMinShoppingCartSubtotalAmountCommandHandlerTests.cs
index 7c43764ed..0489b5d5a 100644
--- a/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ValidateMinShoppingCartSubtotalAmountCommandHandlerTests.cs
+++ b/src/Tests/Grand.Business.Checkout.Tests/Commands/Handlers/Orders/ValidateMinShoppingCartSubtotalAmountCommandHandlerTests.cs
@@ -26,9 +26,11 @@ namespace Grand.Business.Checkout.Tests.Commands.Handlers.Orders
[TestMethod()]
public async Task HandleTest()
{
- var command = new Core.Commands.Checkout.Orders.ValidateMinShoppingCartSubtotalAmountCommand();
- command.Customer = new Domain.Customers.Customer();
- command.Cart = new List<ShoppingCartItem> { new ShoppingCartItem() };
+ var command = new Core.Commands.Checkout.Orders.ValidateMinShoppingCartSubtotalAmountCommand
+ {
+ Customer = new Domain.Customers.Customer(),
+ Cart = new List<ShoppingCartItem> { new ShoppingCartItem() }
+ };
_orderTotalCalculationServiceMock.Setup(x => x.GetShoppingCartSubTotal(It.IsAny<IList<ShoppingCartItem>>(), false)).Returns(() => Task.FromResult<(double discountAmount, List<ApplyDiscount> appliedDiscounts, double subTotalWithoutDiscount, double subTotalWithDiscount, SortedDictionary<double, double> taxRates)>((20,null, 100,100,null)));
//Act
diff --git a/src/Tests/Grand.Business.Checkout.Tests/Services/Orders/MerchandiseReturnServiceTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Services/Orders/MerchandiseReturnServiceTests.cs
index ed3ec8213..20817be92 100644
--- a/src/Tests/Grand.Business.Checkout.Tests/Services/Orders/MerchandiseReturnServiceTests.cs
+++ b/src/Tests/Grand.Business.Checkout.Tests/Services/Orders/MerchandiseReturnServiceTests.cs
@@ -99,7 +99,7 @@ namespace Grand.Business.Checkout.Tests.Services.Orders
//Assert
Assert.IsTrue(result.Any());
- Assert.AreEqual(2, result.Count());
+ Assert.AreEqual(2, result.Count);
}
[TestMethod()]
diff --git a/src/Tests/Grand.Business.Checkout.Tests/Services/Payments/PaymentServiceTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Services/Payments/PaymentServiceTests.cs
index 96d3c5577..99e38b24b 100644
--- a/src/Tests/Grand.Business.Checkout.Tests/Services/Payments/PaymentServiceTests.cs
+++ b/src/Tests/Grand.Business.Checkout.Tests/Services/Payments/PaymentServiceTests.cs
@@ -21,10 +21,11 @@ namespace Grand.Business.Checkout.Tests.Services.Payments
[TestInitialize()]
public void TestInitialize()
{
- _paymentSettings = new PaymentSettings();
- _paymentSettings.ActivePaymentProviderSystemNames = [
- "Payments.TestMethod"
- ];
+ _paymentSettings = new PaymentSettings {
+ ActivePaymentProviderSystemNames = [
+ "Payments.TestMethod"
+ ]
+ };
_settingService = new Mock<ISettingService>();
_paymentProviderMock = new Mock<IPaymentProvider>();
_paymentService = new PaymentService(_paymentSettings, new List<IPaymentProvider> { _paymentProviderMock.Object }, _settingService.Object);
@@ -80,8 +81,9 @@ namespace Grand.Business.Checkout.Tests.Services.Payments
[TestMethod()]
public async Task ProcessPayment_OrderTotalZero_ReturnPaidPaymentStatus()
{
- var request = new PaymentTransaction();
- request.TransactionAmount = 0;
+ var request = new PaymentTransaction {
+ TransactionAmount = 0
+ };
var response = await _paymentService.ProcessPayment(request);
Assert.IsTrue(response.NewPaymentTransactionStatus == TransactionStatus.Paid);
}
diff --git a/src/Tests/Grand.Business.Checkout.Tests/Validators/ShoppingCartValidatorsTests.cs b/src/Tests/Grand.Business.Checkout.Tests/Validators/ShoppingCartValidatorsTests.cs
index 68c9038bc..6c337b88f 100644
--- a/src/Tests/Grand.Business.Checkout.Tests/Validators/ShoppingCartValidatorsTests.cs
+++ b/src/Tests/Grand.Business.Checkout.Tests/Validators/ShoppingCartValidatorsTests.cs
@@ -274,9 +274,10 @@ namespace Grand.Business.Checkout.Tests.Validators
_productServiceMock.Setup(x => x.GetProductById("2", false))
.Returns(() => Task.FromResult(new Product { Id = "2", Name = "test" }));
- var product = new Product { Id = "1", StockQuantity = 1, OrderMinimumQuantity = 1, OrderMaximumQuantity = 10, ManageInventoryMethodId = ManageInventoryMethod.ManageStock };
- product.RequireOtherProducts = true;
- product.RequiredProductIds = "2";
+ var product = new Product { Id = "1", StockQuantity = 1, OrderMinimumQuantity = 1, OrderMaximumQuantity = 10, ManageInventoryMethodId = ManageInventoryMethod.ManageStock,
+ RequireOtherProducts = true,
+ RequiredProductIds = "2"
+ };
var customer = new Domain.Customers.Customer();
customer.ShoppingCartItems.Add(new ShoppingCartItem { ProductId = "2", Quantity = 1, ShoppingCartTypeId = ShoppingCartType.ShoppingCart, StoreId = "1" });
//Act
@@ -306,9 +307,10 @@ namespace Grand.Business.Checkout.Tests.Validators
_productServiceMock.Setup(x => x.GetProductById("2", false))
.Returns(() => Task.FromResult(new Product { Id = "2", Name = "test" }));
- var product = new Product { Id = "1", StockQuantity = 1, OrderMinimumQuantity = 1, OrderMaximumQuantity = 10, ManageInventoryMethodId = ManageInventoryMethod.ManageStock };
- product.RequireOtherProducts = true;
- product.RequiredProductIds = "2";
+ var product = new Product { Id = "1", StockQuantity = 1, OrderMinimumQuantity = 1, OrderMaximumQuantity = 10, ManageInventoryMethodId = ManageInventoryMethod.ManageStock,
+ RequireOtherProducts = true,
+ RequiredProductIds = "2"
+ };
var customer = new Domain.Customers.Customer();
//Act
var result = await shoppingCartRequiredProductValidator.ValidateAsync(new ShoppingCartRequiredProductValidatorRecord(
diff --git a/src/Tests/Grand.Business.Cms.Tests/Extensions/BlogExtensionsTests.cs b/src/Tests/Grand.Business.Cms.Tests/Extensions/BlogExtensionsTests.cs
index 8a14a20e5..5711418cb 100644
--- a/src/Tests/Grand.Business.Cms.Tests/Extensions/BlogExtensionsTests.cs
+++ b/src/Tests/Grand.Business.Cms.Tests/Extensions/BlogExtensionsTests.cs
@@ -26,7 +26,7 @@ namespace Grand.Business.Cms.Tests.Extensions
var from = DateTime.Now;
var to = DateTime.Now.AddDays(3);
var result = _blogPosts.GetPostsByDate(from, to);
- Assert.AreEqual(4, result.Count());
+ Assert.AreEqual(4, result.Count);
Assert.IsTrue(result.Any(b => b.Id.Equals("1")));
Assert.IsTrue(result.Any(b => b.Id.Equals("2")));
Assert.IsTrue(result.Any(b => b.Id.Equals("3")));
@@ -39,7 +39,7 @@ namespace Grand.Business.Cms.Tests.Extensions
var from = DateTime.Now.AddDays(-3);
var to = DateTime.Now.AddDays(-1);
var result = _blogPosts.GetPostsByDate(from, to);
- Assert.AreEqual(0, result.Count());
+ Assert.AreEqual(0, result.Count);
}
}
}
diff --git a/src/Tests/Grand.Business.Common.Tests/Extensions/SeoExtensionsTests.cs b/src/Tests/Grand.Business.Common.Tests/Extensions/SeoExtensionsTests.cs
index f5898cd4a..3ae63670a 100644
--- a/src/Tests/Grand.Business.Common.Tests/Extensions/SeoExtensionsTests.cs
+++ b/src/Tests/Grand.Business.Common.Tests/Extensions/SeoExtensionsTests.cs
@@ -32,8 +32,9 @@ namespace Grand.Business.Common.Tests.Extensions
[TestMethod()]
public void GetSeName_ReturnExpectedValue()
{
- var product = new Product();
- product.SeName = "se-name";
+ var product = new Product {
+ SeName = "se-name"
+ };
//if lang id null , return global se name
Assert.AreEqual("se-name", product.GetSeName<Product>(null));
product.Locales.Add(new Domain.Localization.TranslationEntity { LocaleKey = "SeName", LocaleValue = "se-name-1", LanguageId = "1" });
diff --git a/src/Tests/Grand.Business.Common.Tests/Extensions/TranslateExtensionsTests.cs b/src/Tests/Grand.Business.Common.Tests/Extensions/TranslateExtensionsTests.cs
index c0d19728d..ed0211b2b 100644
--- a/src/Tests/Grand.Business.Common.Tests/Extensions/TranslateExtensionsTests.cs
+++ b/src/Tests/Grand.Business.Common.Tests/Extensions/TranslateExtensionsTests.cs
@@ -14,8 +14,9 @@ namespace Grand.Business.Common.Tests.Extensions
public void GetTranslation_ReturnExpectedValue()
{
//prepare ITranslationEntity
- var product = new Product();
- product.Name = "stname";
+ var product = new Product {
+ Name = "stname"
+ };
product.Locales.Add(new Domain.Localization.TranslationEntity { LanguageId = "PL", LocaleKey = "Name", LocaleValue = "PLName" });
product.Locales.Add(new Domain.Localization.TranslationEntity { LanguageId = "UK", LocaleKey = "Name", LocaleValue = "UKName" });
@@ -44,8 +45,9 @@ namespace Grand.Business.Common.Tests.Extensions
{
var translationServiceMock = new Mock<ITranslationService>();
translationServiceMock.Setup(c => c.GetResource(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<bool>())).Returns("PLenum");
- Product product = new Product();
- product.ManageInventoryMethodId = ManageInventoryMethod.ManageStock;
+ Product product = new Product {
+ ManageInventoryMethodId = ManageInventoryMethod.ManageStock
+ };
var result = product.ManageInventoryMethodId.GetTranslationEnum(translationServiceMock.Object, "PL");
Assert.AreEqual(result, "PLenum");
}
@@ -64,8 +66,9 @@ namespace Grand.Business.Common.Tests.Extensions
var expectedValue = "PLpermision";
var translationServiceMock = new Mock<ITranslationService>();
translationServiceMock.Setup(c => c.GetResource(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<bool>())).Returns(expectedValue);
- Permission record = new Permission();
- record.SystemName = "sysname";
+ Permission record = new Permission {
+ SystemName = "sysname"
+ };
var result = record.GetTranslationPermissionName(translationServiceMock.Object, "PL");
Assert.AreEqual(result, expectedValue);
}
diff --git a/src/Tests/Grand.Business.Common.Tests/Services/Directory/CurrencyServiceTests.cs b/src/Tests/Grand.Business.Common.Tests/Services/Directory/CurrencyServiceTests.cs
index 28992ff55..d7658cd79 100644
--- a/src/Tests/Grand.Business.Common.Tests/Services/Directory/CurrencyServiceTests.cs
+++ b/src/Tests/Grand.Business.Common.Tests/Services/Directory/CurrencyServiceTests.cs
@@ -88,9 +88,10 @@ namespace Grand.Business.Common.Tests.Services.Directory
_aclService = new Mock<IAclService>();
_serviceProvider = new Mock<IServiceProvider>().Object;
- _currencySettings = new CurrencySettings();
- _currencySettings.PrimaryStoreCurrencyId = currencyUSD.Id;
- _currencySettings.PrimaryExchangeRateCurrencyId = currencyEUR.Id;
+ _currencySettings = new CurrencySettings {
+ PrimaryStoreCurrencyId = currencyUSD.Id,
+ PrimaryExchangeRateCurrencyId = currencyEUR.Id
+ };
_currencyService = new CurrencyService(
diff --git a/src/Tests/Grand.Business.Common.Tests/Services/Directory/DateTimeServiceTests.cs b/src/Tests/Grand.Business.Common.Tests/Services/Directory/DateTimeServiceTests.cs
index 93927d3c6..235acf3a3 100644
--- a/src/Tests/Grand.Business.Common.Tests/Services/Directory/DateTimeServiceTests.cs
+++ b/src/Tests/Grand.Business.Common.Tests/Services/Directory/DateTimeServiceTests.cs
@@ -16,8 +16,9 @@ namespace Grand.Business.Common.Tests.Services.Directory
_timeZone = TimeZoneInfo.GetSystemTimeZones().FirstOrDefault(x => x.BaseUtcOffset.Hours == 1);
- _dateTimeSettings = new DateTimeSettings();
- _dateTimeSettings.DefaultStoreTimeZoneId = _timeZone.Id;
+ _dateTimeSettings = new DateTimeSettings {
+ DefaultStoreTimeZoneId = _timeZone.Id
+ };
_dateTimeService = new DateTimeService(_dateTimeSettings);
}
diff --git a/src/Tests/Grand.Business.Common.Tests/Services/Security/AclServiceTest.cs b/src/Tests/Grand.Business.Common.Tests/Services/Security/AclServiceTest.cs
index a58a8b835..87952d8c6 100644
--- a/src/Tests/Grand.Business.Common.Tests/Services/Security/AclServiceTest.cs
+++ b/src/Tests/Grand.Business.Common.Tests/Services/Security/AclServiceTest.cs
@@ -24,16 +24,18 @@ namespace Grand.Business.Common.Tests.Services.Security
{
Product product = null;
Assert.IsFalse(_aclService.Authorize(product, "id"));
- product = new Product();
- product.LimitedToStores = true;
+ product = new Product {
+ LimitedToStores = true
+ };
Assert.IsFalse(_aclService.Authorize(product, "id"));
}
[TestMethod]
public void Authorize_ReturnTrue()
{
- Product product = new Product();
- product.LimitedToStores = false;
+ Product product = new Product {
+ LimitedToStores = false
+ };
Assert.IsTrue(_aclService.Authorize(product, "id"));
Assert.IsTrue(_aclService.Authorize(product, ""));
_accessControlConfig.IgnoreStoreLimitations = true;
diff --git a/src/Tests/Grand.Business.Customers.Tests/Extensions/AffiliateExtensionsTests.cs b/src/Tests/Grand.Business.Customers.Tests/Extensions/AffiliateExtensionsTests.cs
index 30766f9b9..3d321acc6 100644
--- a/src/Tests/Grand.Business.Customers.Tests/Extensions/AffiliateExtensionsTests.cs
+++ b/src/Tests/Grand.Business.Customers.Tests/Extensions/AffiliateExtensionsTests.cs
@@ -54,7 +54,7 @@ namespace Grand.Business.Customers.Tests.Extensions
[TestMethod()]
public void GetFullName_ValidParameter_ReturnLastName()
{
- var fullName = string.Format("{0} {1}", "first name", "lastName");
+ var fullName = $"{"first name"} {"lastName"}";
Affiliate affiliate = new Affiliate {
Address = new Domain.Common.Address { LastName = "lastName", FirstName = "first name" }
};
diff --git a/src/Tests/Grand.Business.Customers.Tests/Handler/ActiveVendorCommandHandlerTests.cs b/src/Tests/Grand.Business.Customers.Tests/Handler/ActiveVendorCommandHandlerTests.cs
index c259fe686..4cb485f7b 100644
--- a/src/Tests/Grand.Business.Customers.Tests/Handler/ActiveVendorCommandHandlerTests.cs
+++ b/src/Tests/Grand.Business.Customers.Tests/Handler/ActiveVendorCommandHandlerTests.cs
@@ -32,9 +32,11 @@ namespace Grand.Business.Customers.Tests.Handler
[TestMethod()]
public async Task Handle_ValidArguments_InsertCustomerGroupInCustomer()
{
- var command = new ActiveVendorCommand { CustomerIds = new List<string> { "id" } };
- command.Active = true;
- command.Vendor = new Domain.Vendors.Vendor();
+ var command = new ActiveVendorCommand {
+ CustomerIds = new List<string> { "id" },
+ Active = true,
+ Vendor = new Domain.Vendors.Vendor()
+ };
_cumstomerServiceMock.Setup(c => c.GetCustomerById(It.IsAny<string>())).Returns(() => Task.FromResult(new Customer { Active = true }));
_groupServiceMock.Setup(c => c.IsAdmin(It.IsAny<Customer>())).Returns(() => Task.FromResult(false));
_groupServiceMock.Setup(c => c.GetCustomerGroupBySystemName(It.IsAny<string>())).Returns(() => Task.FromResult(new CustomerGroup()));
@@ -47,9 +49,11 @@ namespace Grand.Business.Customers.Tests.Handler
[TestMethod()]
public async Task Handle_ValidArguments_DeleteCustomerGroupInCustomer()
{
- var command = new ActiveVendorCommand { CustomerIds = new List<string> { "id" } };
- command.Active = false;
- command.Vendor = new Domain.Vendors.Vendor();
+ var command = new ActiveVendorCommand {
+ CustomerIds = new List<string> { "id" },
+ Active = false,
+ Vendor = new Domain.Vendors.Vendor()
+ };
_cumstomerServiceMock.Setup(c => c.GetCustomerById(It.IsAny<string>())).Returns(() => Task.FromResult(new Customer { Active = true }));
_groupServiceMock.Setup(c => c.IsAdmin(It.IsAny<Customer>())).Returns(() => Task.FromResult(false));
_groupServiceMock.Setup(c => c.IsVendor(It.IsAny<Customer>())).Returns(() => Task.FromResult(true));
diff --git a/src/Tests/Grand.Business.Customers.Tests/Queries/Handlers/GetGroupBySystemNameQueryHandlerTests.cs b/src/Tests/Grand.Business.Customers.Tests/Queries/Handlers/GetGroupBySystemNameQueryHandlerTests.cs
index 9bd46f84b..85ceb36c9 100644
--- a/src/Tests/Grand.Business.Customers.Tests/Queries/Handlers/GetGroupBySystemNameQueryHandlerTests.cs
+++ b/src/Tests/Grand.Business.Customers.Tests/Queries/Handlers/GetGroupBySystemNameQueryHandlerTests.cs
@@ -22,8 +22,9 @@ namespace Grand.Business.Customers.Tests.Queries.Handlers
public async Task HandleTest()
{
//Assert
- var groupBySystemNameQuery = new Core.Queries.Customers.GetGroupBySystemNameQuery();
- groupBySystemNameQuery.SystemName = "sample";
+ var groupBySystemNameQuery = new Core.Queries.Customers.GetGroupBySystemNameQuery {
+ SystemName = "sample"
+ };
//Act
_ = await handler.Handle(groupBySystemNameQuery, CancellationToken.None);
diff --git a/src/Tests/Grand.Business.Customers.Tests/Services/CustomerHistoryPasswordServiceTests.cs b/src/Tests/Grand.Business.Customers.Tests/Services/CustomerHistoryPasswordServiceTests.cs
index c8f8df0e9..8cc4a5ce8 100644
--- a/src/Tests/Grand.Business.Customers.Tests/Services/CustomerHistoryPasswordServiceTests.cs
+++ b/src/Tests/Grand.Business.Customers.Tests/Services/CustomerHistoryPasswordServiceTests.cs
@@ -43,7 +43,7 @@ namespace Grand.Business.Customers.Tests.Services
//Act
var result = await _customerHistoryPasswordService.GetPasswords("1", 1);
//Asser
- Assert.IsTrue(result.Count() == 1);
+ Assert.IsTrue(result.Count == 1);
}
}
}
\ No newline at end of file
diff --git a/src/Tests/Grand.Business.Customers.Tests/Services/CustomerManagerServiceTests.cs b/src/Tests/Grand.Business.Customers.Tests/Services/CustomerManagerServiceTests.cs
index 48cbcb60d..904b224d9 100644
--- a/src/Tests/Grand.Business.Customers.Tests/Services/CustomerManagerServiceTests.cs
+++ b/src/Tests/Grand.Business.Customers.Tests/Services/CustomerManagerServiceTests.cs
@@ -33,8 +33,9 @@ namespace Grand.Business.Customers.Tests.Services
_mediatorMock = new Mock<IMediator>();
_userFieldServiceMock = new Mock<IUserFieldService>();
_customerHistoryPasswordServiceMock = new Mock<ICustomerHistoryPasswordService>();
- _customerSettings = new CustomerSettings();
- _customerSettings.AllowUsersToChangeUsernames = true;
+ _customerSettings = new CustomerSettings {
+ AllowUsersToChangeUsernames = true
+ };
_customerManagerService = new CustomerManagerService(_customerServiceMock.Object, _groupServiceMock.Object,
_encryptionServiceMock.Object, _mediatorMock.Object, _userFieldServiceMock.Object,
diff --git a/src/Tests/Grand.Business.Customers.Tests/Services/CustomerServiceTests.cs b/src/Tests/Grand.Business.Customers.Tests/Services/CustomerServiceTests.cs
index 3979e8537..eb5b94b17 100644
--- a/src/Tests/Grand.Business.Customers.Tests/Services/CustomerServiceTests.cs
+++ b/src/Tests/Grand.Business.Customers.Tests/Services/CustomerServiceTests.cs
@@ -367,8 +367,9 @@ namespace Grand.Business.Customers.Tests.Services
var customer = new Customer();
await _repository.InsertAsync(customer);
//Act
- var address = new Address();
- address.Name = "BillingAddress";
+ var address = new Address {
+ Name = "BillingAddress"
+ };
await _customerService.UpdateBillingAddress(address, customer.Id);
//Assert
Assert.AreEqual("BillingAddress", _repository.Table.FirstOrDefault(x => x.Id == customer.Id).BillingAddress.Name);
@@ -381,8 +382,9 @@ namespace Grand.Business.Customers.Tests.Services
var customer = new Customer();
await _repository.InsertAsync(customer);
//Act
- var address = new Address();
- address.Name = "ShippingAddress";
+ var address = new Address {
+ Name = "ShippingAddress"
+ };
await _customerService.UpdateShippingAddress(address, customer.Id);
//Assert
Assert.AreEqual("ShippingAddress", _repository.Table.FirstOrDefault(x => x.Id == customer.Id).ShippingAddress.Name);
diff --git a/src/Tests/Grand.Business.Marketing.Tests/Services/Courses/CourseLessonServiceTests.cs b/src/Tests/Grand.Business.Marketing.Tests/Services/Courses/CourseLessonServiceTests.cs
index e40278525..6e9daf955 100644
--- a/src/Tests/Grand.Business.Marketing.Tests/Services/Courses/CourseLessonServiceTests.cs
+++ b/src/Tests/Grand.Business.Marketing.Tests/Services/Courses/CourseLessonServiceTests.cs
@@ -55,7 +55,7 @@ namespace Grand.Business.Marketing.Tests.Services.Courses
//Assert
Assert.IsNotNull(result);
- Assert.AreEqual(1, result.Count());
+ Assert.AreEqual(1, result.Count);
}
[TestMethod()]
diff --git a/src/Tests/Grand.Business.Marketing.Tests/Services/Newsletters/NewsLetterSubscriptionServiceTests.cs b/src/Tests/Grand.Business.Marketing.Tests/Services/Newsletters/NewsLetterSubscriptionServiceTests.cs
index b3890270a..b77adf6d7 100644
--- a/src/Tests/Grand.Business.Marketing.Tests/Services/Newsletters/NewsLetterSubscriptionServiceTests.cs
+++ b/src/Tests/Grand.Business.Marketing.Tests/Services/Newsletters/NewsLetterSubscriptionServiceTests.cs
@@ -35,8 +35,9 @@ namespace Grand.Business.Marketing.Tests.Services.Newsletters
public void InsertNewsLetterSubscription_InvalidEmail_ThrowException()
{
var email = "NotValidEmail";
- var newsLetterSubscription = new NewsLetterSubscription();
- newsLetterSubscription.Email = email;
+ var newsLetterSubscription = new NewsLetterSubscription {
+ Email = email
+ };
Assert.ThrowsExceptionAsync<GrandException>(async () => await _newsLetterSubscriptionService.InsertNewsLetterSubscription(newsLetterSubscription));
}
diff --git a/src/Tests/Grand.Business.Messages.Tests/Queries/Handlers/GetCustomerByIdQueryHandlerTests.cs b/src/Tests/Grand.Business.Messages.Tests/Queries/Handlers/GetCustomerByIdQueryHandlerTests.cs
index bbb7fc00c..beeda8c3a 100644
--- a/src/Tests/Grand.Business.Messages.Tests/Queries/Handlers/GetCustomerByIdQueryHandlerTests.cs
+++ b/src/Tests/Grand.Business.Messages.Tests/Queries/Handlers/GetCustomerByIdQueryHandlerTests.cs
@@ -25,8 +25,9 @@ namespace Grand.Business.Messages.Tests.Queries.Handlers
public async Task HandleTest()
{
//Assert
- var customerQuery = new Core.Queries.Messages.GetCustomerByIdQuery();
- customerQuery.Id = "1";
+ var customerQuery = new Core.Queries.Messages.GetCustomerByIdQuery {
+ Id = "1"
+ };
//Act
var result = await handler.Handle(customerQuery, CancellationToken.None);
diff --git a/src/Tests/Grand.Data.Tests/LiteDb/LiteDbRepositoryTests.cs b/src/Tests/Grand.Data.Tests/LiteDb/LiteDbRepositoryTests.cs
index fe42299f8..deabbf0b9 100644
--- a/src/Tests/Grand.Data.Tests/LiteDb/LiteDbRepositoryTests.cs
+++ b/src/Tests/Grand.Data.Tests/LiteDb/LiteDbRepositoryTests.cs
@@ -155,7 +155,7 @@ namespace Grand.Data.Tests.LiteDb
var p = _myRepository.GetById("1");
//Assert
- Assert.IsTrue(p.Phones.Count() == 2);
+ Assert.IsTrue(p.Phones.Count == 2);
Assert.IsTrue(p.UpdatedOnUtc.HasValue);
Assert.IsTrue(p.UpdatedBy == "user");
}
@@ -183,7 +183,7 @@ namespace Grand.Data.Tests.LiteDb
var p3 = _myRepository.GetById("3");
//Assert
- Assert.IsTrue(p1.Phones.Count() == 2 && p2.Phones.Count() == 2 && p3.Phones.Count() == 0);
+ Assert.IsTrue(p1.Phones.Count == 2 && p2.Phones.Count == 2 && p3.Phones.Count == 0);
Assert.IsTrue(p1.UpdatedOnUtc.HasValue);
Assert.IsTrue(p1.UpdatedBy == "user");
@@ -211,7 +211,7 @@ namespace Grand.Data.Tests.LiteDb
var p1 = _myRepository.GetById("1");
//Assert
- Assert.IsTrue(p1.UserFields.Count() == 2);
+ Assert.IsTrue(p1.UserFields.Count == 2);
Assert.IsTrue(p1.UpdatedOnUtc.HasValue);
Assert.IsTrue(p1.UpdatedBy == "user");
@@ -240,7 +240,7 @@ namespace Grand.Data.Tests.LiteDb
var p1 = _myRepository.GetById("1");
//Assert
- Assert.IsTrue(p1.UserFields.Count() == 1);
+ Assert.IsTrue(p1.UserFields.Count == 1);
Assert.IsTrue(p1.UpdatedOnUtc.HasValue);
Assert.IsTrue(p1.UpdatedBy == "user");
@@ -275,7 +275,7 @@ namespace Grand.Data.Tests.LiteDb
var p2 = _myRepository.GetById("2");
//Assert
- Assert.IsTrue(p1.UserFields.Count() == 1 && p2.UserFields.Count() == 2);
+ Assert.IsTrue(p1.UserFields.Count == 1 && p2.UserFields.Count == 2);
Assert.IsTrue(p1.UpdatedOnUtc.HasValue);
Assert.IsTrue(p1.UpdatedBy == "user");
}
diff --git a/src/Tests/Grand.Data.Tests/MongoDb/CoreTestConfiguration.cs b/src/Tests/Grand.Data.Tests/MongoDb/CoreTestConfiguration.cs
index b0f390a1f..05cbd47af 100644
--- a/src/Tests/Grand.Data.Tests/MongoDb/CoreTestConfiguration.cs
+++ b/src/Tests/Grand.Data.Tests/MongoDb/CoreTestConfiguration.cs
@@ -37,25 +37,15 @@ namespace Grand.Data.Tests.MongoDb
private static TraceSource __traceSource;
// static properties
- public static ICluster Cluster {
- get { return __cluster.Value; }
- }
+ public static ICluster Cluster => __cluster.Value;
- public static ConnectionString ConnectionString {
- get { return __connectionString; }
- }
+ public static ConnectionString ConnectionString => __connectionString;
- public static DatabaseNamespace DatabaseNamespace {
- get { return __databaseNamespace; }
- }
+ public static DatabaseNamespace DatabaseNamespace => __databaseNamespace;
- public static MessageEncoderSettings MessageEncoderSettings {
- get { return __messageEncoderSettings; }
- }
+ public static MessageEncoderSettings MessageEncoderSettings => __messageEncoderSettings;
- public static TraceSource TraceSource {
- get { return __traceSource; }
- }
+ public static TraceSource TraceSource => __traceSource;
// static methods
public static ClusterBuilder ConfigureCluster()
@@ -131,7 +121,7 @@ namespace Grand.Data.Tests.MongoDb
description => description.Type.IsWritable());
if (__traceSource != null)
{
- __traceSource.TraceEvent(TraceEventType.Information, 0, $"CreateCluster: DescriptionChanged event handler called.");
+ __traceSource.TraceEvent(TraceEventType.Information, 0, "CreateCluster: DescriptionChanged event handler called.");
__traceSource.TraceEvent(TraceEventType.Information, 0, $"CreateCluster: anyWritableServer = {anyWritableServer}.");
__traceSource.TraceEvent(TraceEventType.Information, 0, $"CreateCluster: new description: {e.NewClusterDescription}.");
}
@@ -147,9 +137,8 @@ namespace Grand.Data.Tests.MongoDb
SpinWait.SpinUntil(() => Interlocked.CompareExchange(ref hasWritableServer, 0, 0) != 0, TimeSpan.FromSeconds(30));
if (Interlocked.CompareExchange(ref hasWritableServer, 0, 0) == 0)
{
- var message = string.Format(
- "Test cluster has no writable server. Client view of the cluster is {0}.",
- cluster.Description);
+ var message =
+ $"Test cluster has no writable server. Client view of the cluster is {cluster.Description}.";
throw new Exception(message);
}
diff --git a/src/Tests/Grand.Data.Tests/MongoDb/DriverTestConfiguration.cs b/src/Tests/Grand.Data.Tests/MongoDb/DriverTestConfiguration.cs
index 38aaa87be..b01ee6ade 100644
--- a/src/Tests/Grand.Data.Tests/MongoDb/DriverTestConfiguration.cs
+++ b/src/Tests/Grand.Data.Tests/MongoDb/DriverTestConfiguration.cs
@@ -36,9 +36,7 @@ namespace Grand.Data.Tests.MongoDb
/// <summary>
/// Gets the test client.
/// </summary>
- public static MongoClient Client {
- get { return __client.Value; }
- }
+ public static MongoClient Client => __client.Value;
/// <summary>
/// Gets the collection namespace.
@@ -46,9 +44,7 @@ namespace Grand.Data.Tests.MongoDb
/// <value>
/// The collection namespace.
/// </value>
- public static CollectionNamespace CollectionNamespace {
- get { return __collectionNamespace; }
- }
+ public static CollectionNamespace CollectionNamespace => __collectionNamespace;
/// <summary>
/// Gets the database namespace.
@@ -56,8 +52,6 @@ namespace Grand.Data.Tests.MongoDb
/// <value>
/// The database namespace.
/// </value>
- public static DatabaseNamespace DatabaseNamespace {
- get { return __databaseNamespace; }
- }
+ public static DatabaseNamespace DatabaseNamespace => __databaseNamespace;
}
}
diff --git a/src/Tests/Grand.Data.Tests/MongoDb/MongoRepositoryTests.cs b/src/Tests/Grand.Data.Tests/MongoDb/MongoRepositoryTests.cs
index da8e72bc7..a6ad35a46 100644
--- a/src/Tests/Grand.Data.Tests/MongoDb/MongoRepositoryTests.cs
+++ b/src/Tests/Grand.Data.Tests/MongoDb/MongoRepositoryTests.cs
@@ -166,7 +166,7 @@ namespace Grand.Data.Tests.MongoDb
var p = _myRepository.GetById("1");
//Assert
- Assert.IsTrue(p.Phones.Count() == 2);
+ Assert.IsTrue(p.Phones.Count == 2);
Assert.IsTrue(p!.CreatedBy == "user");
Assert.IsTrue(p!.CreatedOnUtc.Year == DateTime.UtcNow.Year);
Assert.IsTrue(p!.UpdatedBy == "user");
@@ -196,7 +196,7 @@ namespace Grand.Data.Tests.MongoDb
var p3 = _myRepository.GetById("3");
//Assert
- Assert.IsTrue(p1.Phones.Count() == 2 && p2.Phones.Count() == 2 && p3.Phones.Count() == 0);
+ Assert.IsTrue(p1.Phones.Count == 2 && p2.Phones.Count == 2 && p3.Phones.Count == 0);
Assert.IsTrue(p1!.CreatedBy == "user");
Assert.IsTrue(p1!.CreatedOnUtc.Year == DateTime.UtcNow.Year);
Assert.IsTrue(p1!.UpdatedBy == "user");
@@ -226,7 +226,7 @@ namespace Grand.Data.Tests.MongoDb
var p1 = _myRepository.GetById("1");
//Assert
- Assert.IsTrue(p1.UserFields.Count() == 1);
+ Assert.IsTrue(p1.UserFields.Count == 1);
Assert.IsTrue(p1!.CreatedBy == "user");
Assert.IsTrue(p1!.CreatedOnUtc.Year == DateTime.UtcNow.Year);
Assert.IsTrue(p1!.UpdatedBy == "user");
@@ -257,7 +257,7 @@ namespace Grand.Data.Tests.MongoDb
var p1 = _myRepository.GetById("1");
//Assert
- Assert.IsTrue(p1.UserFields.Count() == 1);
+ Assert.IsTrue(p1.UserFields.Count == 1);
Assert.IsTrue(p1!.CreatedBy == "user");
Assert.IsTrue(p1!.CreatedOnUtc.Year == DateTime.UtcNow.Year);
Assert.IsTrue(p1!.UpdatedBy == "user");
@@ -294,7 +294,7 @@ namespace Grand.Data.Tests.MongoDb
var p2 = _myRepository.GetById("2");
//Assert
- Assert.IsTrue(p1.UserFields.Count() == 1 && p2.UserFields.Count() == 2);
+ Assert.IsTrue(p1.UserFields.Count == 1 && p2.UserFields.Count == 2);
Assert.IsTrue(p1!.CreatedBy == "user");
Assert.IsTrue(p1!.CreatedOnUtc.Year == DateTime.UtcNow.Year);
Assert.IsTrue(p1!.UpdatedBy == "user");
diff --git a/src/Tests/Grand.Domain.Tests/Blogs/BlogExtensionsTests.cs b/src/Tests/Grand.Domain.Tests/Blogs/BlogExtensionsTests.cs
index 18a19ab63..ea4bbd963 100644
--- a/src/Tests/Grand.Domain.Tests/Blogs/BlogExtensionsTests.cs
+++ b/src/Tests/Grand.Domain.Tests/Blogs/BlogExtensionsTests.cs
@@ -13,7 +13,7 @@ namespace Grand.Domain.Tests.Blogs
Tags = "e-commerce, blog, moey"
};
- Assert.AreEqual(3, blogPost.ParseTags().Count());
+ Assert.AreEqual(3, blogPost.ParseTags().Length);
}
[TestMethod()]
@@ -24,7 +24,7 @@ namespace Grand.Domain.Tests.Blogs
new BlogPost { StartDateUtc = new DateTime(2010,02,01) },
new BlogPost { StartDateUtc = new DateTime(2010,03,01) }
};
- Assert.AreEqual(2, blogPosts.GetPostsByDate(new DateTime(2010, 01, 01), new DateTime(2010, 02, 28)).Count());
+ Assert.AreEqual(2, blogPosts.GetPostsByDate(new DateTime(2010, 01, 01), new DateTime(2010, 02, 28)).Count);
}
}
}
\ No newline at end of file
diff --git a/src/Tests/Grand.Infrastructure.Tests/Plugins/BasePluginTests.cs b/src/Tests/Grand.Infrastructure.Tests/Plugins/BasePluginTests.cs
index 91eb11047..75273a440 100644
--- a/src/Tests/Grand.Infrastructure.Tests/Plugins/BasePluginTests.cs
+++ b/src/Tests/Grand.Infrastructure.Tests/Plugins/BasePluginTests.cs
@@ -40,7 +40,7 @@ namespace Grand.Infrastructure.Tests.Plugins
await sampleBasePlugin.Install();
await sampleBasePlugin.Uninstall();
var plugins = PluginExtensions.ParseInstalledPluginsFile(CommonPath.InstalledPluginsFilePath);
- Assert.AreEqual(0, plugins.Count());
+ Assert.AreEqual(0, plugins.Count);
}
[TestMethod()]
@@ -48,7 +48,7 @@ namespace Grand.Infrastructure.Tests.Plugins
{
await sampleBasePlugin.Uninstall();
var plugins = PluginExtensions.ParseInstalledPluginsFile(CommonPath.InstalledPluginsFilePath);
- Assert.AreEqual(0, plugins.Count());
+ Assert.AreEqual(0, plugins.Count);
}
}
}
\ No newline at end of file
diff --git a/src/Tests/Grand.Infrastructure.Tests/Plugins/PluginExtensionsTests.cs b/src/Tests/Grand.Infrastructure.Tests/Plugins/PluginExtensionsTests.cs
index 1c302715b..7544d6869 100644
--- a/src/Tests/Grand.Infrastructure.Tests/Plugins/PluginExtensionsTests.cs
+++ b/src/Tests/Grand.Infrastructure.Tests/Plugins/PluginExtensionsTests.cs
@@ -27,7 +27,7 @@ namespace Grand.Infrastructure.Tests.Plugins
{
await PluginExtensions.SaveInstalledPluginsFile(new List<string> { "plugin1", "plugin2" }, CommonPath.InstalledPluginsFilePath);
var plugins = PluginExtensions.ParseInstalledPluginsFile(CommonPath.InstalledPluginsFilePath);
- Assert.AreEqual(2, plugins.Count());
+ Assert.AreEqual(2, plugins.Count);
}
}
}
\ No newline at end of file
diff --git a/src/Tests/Grand.Infrastructure.Tests/Plugins/SampleBasePlugin.cs b/src/Tests/Grand.Infrastructure.Tests/Plugins/SampleBasePlugin.cs
index ba4b933ca..b6f97f379 100644
--- a/src/Tests/Grand.Infrastructure.Tests/Plugins/SampleBasePlugin.cs
+++ b/src/Tests/Grand.Infrastructure.Tests/Plugins/SampleBasePlugin.cs
@@ -12,12 +12,8 @@ namespace Grand.Infrastructure.Tests.Plugins
};
public override PluginInfo PluginInfo {
- get {
- return _pluginInfo;
- }
- set {
- _pluginInfo = value;
- }
+ get => _pluginInfo;
+ set => _pluginInfo = value;
}
public override string ConfigurationUrl()
{
diff --git a/src/Tests/Grand.Infrastructure.Tests/TypeConverters/Converter/CaptchaInterfaceConverter.cs b/src/Tests/Grand.Infrastructure.Tests/TypeConverters/Converter/CaptchaInterfaceConverter.cs
index 7f250fed6..52a80f703 100644
--- a/src/Tests/Grand.Infrastructure.Tests/TypeConverters/Converter/CaptchaInterfaceConverter.cs
+++ b/src/Tests/Grand.Infrastructure.Tests/TypeConverters/Converter/CaptchaInterfaceConverter.cs
@@ -11,12 +11,13 @@ public class CaptchaInterfaceConverter
public void ConvertFrom_CaptchaObject_To_Json()
{
//Arrange
- var sample = new SampleClass();
- sample.CaptchaValidModel = new CaptchaModel {
- ReCaptchaResponse = "xxx",
- ReCaptchaResponseField = "yyy",
- ReCaptchaChallengeField = "zzz",
- ReCaptchaResponseValue = "uuu"
+ var sample = new SampleClass {
+ CaptchaValidModel = new CaptchaModel {
+ ReCaptchaResponse = "xxx",
+ ReCaptchaResponseField = "yyy",
+ ReCaptchaChallengeField = "zzz",
+ ReCaptchaResponseValue = "uuu"
+ }
};
//Act
var jsonString = JsonSerializer.Serialize(sample);
diff --git a/src/Tests/Grand.Infrastructure.Tests/TypeConverters/Converter/RefreshTokenTypeConverterTests.cs b/src/Tests/Grand.Infrastructure.Tests/TypeConverters/Converter/RefreshTokenTypeConverterTests.cs
index 8ee923d94..91bd57ead 100644
--- a/src/Tests/Grand.Infrastructure.Tests/TypeConverters/Converter/RefreshTokenTypeConverterTests.cs
+++ b/src/Tests/Grand.Infrastructure.Tests/TypeConverters/Converter/RefreshTokenTypeConverterTests.cs
@@ -37,11 +37,12 @@ namespace Grand.Infrastructure.Tests.TypeConverters.Converter
[TestMethod()]
public void ConvertToTest_NotNull()
{
- var refreshToken = new RefreshToken();
- refreshToken.RefreshId = Guid.NewGuid().ToString();
- refreshToken.Token = Guid.NewGuid().ToString();
- refreshToken.IsActive = true;
- refreshToken.ValidTo = DateTime.UtcNow.AddDays(1);
+ var refreshToken = new RefreshToken {
+ RefreshId = Guid.NewGuid().ToString(),
+ Token = Guid.NewGuid().ToString(),
+ IsActive = true,
+ ValidTo = DateTime.UtcNow.AddDays(1)
+ };
var str = refreshTokenTypeConverter.ConvertTo(refreshToken, typeof(string));
Assert.IsNotNull(str);
Assert.IsInstanceOfType(str, typeof(string));
@@ -49,11 +50,12 @@ namespace Grand.Infrastructure.Tests.TypeConverters.Converter
[TestMethod()]
public void ConvertToTest_decimal_Exception()
{
- var refreshToken = new RefreshToken();
- refreshToken.RefreshId = Guid.NewGuid().ToString();
- refreshToken.Token = Guid.NewGuid().ToString();
- refreshToken.IsActive = true;
- refreshToken.ValidTo = DateTime.UtcNow.AddDays(1);
+ var refreshToken = new RefreshToken {
+ RefreshId = Guid.NewGuid().ToString(),
+ Token = Guid.NewGuid().ToString(),
+ IsActive = true,
+ ValidTo = DateTime.UtcNow.AddDays(1)
+ };
Assert.ThrowsException<NotSupportedException>(() => _ = refreshTokenTypeConverter.ConvertTo(refreshToken, typeof(decimal)));
}
diff --git a/src/Tests/Grand.Infrastructure.Tests/TypeConverters/Converter/ShippingOptionTypeConverterTests.cs b/src/Tests/Grand.Infrastructure.Tests/TypeConverters/Converter/ShippingOptionTypeConverterTests.cs
index 99d15ac3e..0e3571c98 100644
--- a/src/Tests/Grand.Infrastructure.Tests/TypeConverters/Converter/ShippingOptionTypeConverterTests.cs
+++ b/src/Tests/Grand.Infrastructure.Tests/TypeConverters/Converter/ShippingOptionTypeConverterTests.cs
@@ -26,10 +26,11 @@ namespace Grand.Infrastructure.Tests.TypeConverters.Converter
[TestMethod()]
public void ConvertToTest_NotNull()
{
- ShippingOption shippingOption = new ShippingOption();
- shippingOption.ShippingRateProviderSystemName = "Ground";
- shippingOption.Name = "sample";
- shippingOption.Rate = 10;
+ ShippingOption shippingOption = new ShippingOption {
+ ShippingRateProviderSystemName = "Ground",
+ Name = "sample",
+ Rate = 10
+ };
var result = _converter.ConvertTo(shippingOption, typeof(string));
Assert.IsNotNull(result);
}
diff --git a/src/Tests/Grand.Infrastructure.Tests/Validators/FluentValidationFilterTests.cs b/src/Tests/Grand.Infrastructure.Tests/Validators/FluentValidationFilterTests.cs
index 9ca61c19f..1a1398dce 100644
--- a/src/Tests/Grand.Infrastructure.Tests/Validators/FluentValidationFilterTests.cs
+++ b/src/Tests/Grand.Infrastructure.Tests/Validators/FluentValidationFilterTests.cs
@@ -25,8 +25,11 @@ namespace Grand.Infrastructure.Tests.Validators
var actionFilter = new ValidationFilter(serviceProvider);
- var httpContext = new DefaultHttpContext();
- httpContext.Request.Method = "POST";
+ var httpContext = new DefaultHttpContext {
+ Request = {
+ Method = "POST"
+ }
+ };
var actionContext = new ActionContext(httpContext,
new RouteData(),
@@ -68,8 +71,11 @@ namespace Grand.Infrastructure.Tests.Validators
var actionFilter = new ValidationFilter(serviceProvider);
- var httpContext = new DefaultHttpContext();
- httpContext.Request.Method = "POST";
+ var httpContext = new DefaultHttpContext {
+ Request = {
+ Method = "POST"
+ }
+ };
var actionContext = new ActionContext(httpContext,
new RouteData(),
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Menu/Edit.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Menu/Edit.cshtml
index 2838404fc..3442db331 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Menu/Edit.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Menu/Edit.cshtml
@@ -21,7 +21,7 @@
@Loc["Admin.Configuration.Menu.Edit"] - @Model.SystemName
@if (parent != null && parent.Id != Model.Id)
{
- <small><i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc[parent.ResourceName], "Edit", new { parent.Id, area = @Constants.AreaAdmin })</small>
+ <small><i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc[parent.ResourceName], "Edit", new { parent.Id, area = Constants.AreaAdmin })</small>
}
else
{
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Permission/Index.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Permission/Index.cshtml
index 415ce5c9f..84042856a 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Permission/Index.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Permission/Index.cshtml
@@ -94,7 +94,7 @@
@foreach (var item in groupList)
{
<li>
- <a class="btnUpdatePermission" href="@Url.Action("Update", new { area = Constants.AreaAdmin, @item.SystemName })">@item.Name</a>
+ <a class="btnUpdatePermission" href="@Url.Action("Update", new { area = Constants.AreaAdmin, item.SystemName })">@item.Name</a>
</li>
}
</ul>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/HeadAdmin.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/HeadAdmin.cshtml
index 4e83c087f..e859beb80 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/HeadAdmin.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/HeadAdmin.cshtml
@@ -47,7 +47,7 @@
<script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/admin.common.js"></script>
<script asp-location="Head" asp-src="@string.Format(Common.WwwRoot+"/administration/kendo/scripts/{0}/kendo.ui.core.min.js", kendoVersion)"></script>
<script asp-location="Head" asp-src="@string.Format(Common.WwwRoot+"/administration/kendo/scripts/{0}/kendo.grid.js", kendoVersion)"></script>
- <script asp-location="Head" asp-src="@string.Format(Common.WwwRoot+"/administration/kendo/scripts/{0}/cultures/kendo.culture.{1}.js", kendoVersion, @CultureInfo.CurrentCulture.Name)"></script>
+ <script asp-location="Head" asp-src="@string.Format(Common.WwwRoot+"/administration/kendo/scripts/{0}/cultures/kendo.culture.{1}.js", kendoVersion, CultureInfo.CurrentCulture.Name)"></script>
<script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/bootstrap/js/popper.min.js"></script>
diff --git a/src/Web/Grand.Web.Admin/Controllers/AddressAttributeController.cs b/src/Web/Grand.Web.Admin/Controllers/AddressAttributeController.cs
index b4b06542c..7ef7ad8d6 100644
--- a/src/Web/Grand.Web.Admin/Controllers/AddressAttributeController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/AddressAttributeController.cs
@@ -39,10 +39,16 @@ namespace Grand.Web.Admin.Controllers
#region Address attributes
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
- public IActionResult List() => View();
+ public IActionResult List()
+ {
+ return View();
+ }
[PermissionAuthorizeAction(PermissionActionName.List)]
[HttpPost]
diff --git a/src/Web/Grand.Web.Admin/Controllers/ApiUserController.cs b/src/Web/Grand.Web.Admin/Controllers/ApiUserController.cs
index c3163d057..1053c52e5 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ApiUserController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ApiUserController.cs
@@ -27,7 +27,10 @@ namespace Grand.Web.Admin.Controllers
return (_encryptionService.EncryptText(password, pk), pk);
}
- public IActionResult Index() => View();
+ public IActionResult Index()
+ {
+ return View();
+ }
[HttpPost]
public async Task<IActionResult> List(string email, DataSourceRequest command)
diff --git a/src/Web/Grand.Web.Admin/Controllers/BlogController.cs b/src/Web/Grand.Web.Admin/Controllers/BlogController.cs
index c7a0a728c..8d65a1670 100644
--- a/src/Web/Grand.Web.Admin/Controllers/BlogController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/BlogController.cs
@@ -67,9 +67,15 @@ namespace Grand.Web.Admin.Controllers
#region Blog posts
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
- public IActionResult List() => View();
+ public IActionResult List()
+ {
+ return View();
+ }
[PermissionAuthorizeAction(PermissionActionName.List)]
[HttpPost]
@@ -277,7 +283,10 @@ namespace Grand.Web.Admin.Controllers
#endregion
#region Categories
- public IActionResult CategoryList() => View();
+ public IActionResult CategoryList()
+ {
+ return View();
+ }
[PermissionAuthorizeAction(PermissionActionName.List)]
[HttpPost]
diff --git a/src/Web/Grand.Web.Admin/Controllers/BrandController.cs b/src/Web/Grand.Web.Admin/Controllers/BrandController.cs
index bdece2ad5..441882a22 100644
--- a/src/Web/Grand.Web.Admin/Controllers/BrandController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/BrandController.cs
@@ -82,7 +82,10 @@ namespace Grand.Web.Admin.Controllers
#region List
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
public async Task<IActionResult> List()
{
diff --git a/src/Web/Grand.Web.Admin/Controllers/CampaignController.cs b/src/Web/Grand.Web.Admin/Controllers/CampaignController.cs
index 6b7ac41b1..e12135a4b 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CampaignController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CampaignController.cs
@@ -47,9 +47,15 @@ namespace Grand.Web.Admin.Controllers
_storeService = storeService;
}
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
- public IActionResult List() => View();
+ public IActionResult List()
+ {
+ return View();
+ }
[PermissionAuthorizeAction(PermissionActionName.List)]
[HttpPost]
diff --git a/src/Web/Grand.Web.Admin/Controllers/CategoryController.cs b/src/Web/Grand.Web.Admin/Controllers/CategoryController.cs
index 48794fceb..2304c5c37 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CategoryController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CategoryController.cs
@@ -76,7 +76,10 @@ namespace Grand.Web.Admin.Controllers
#region List
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
public async Task<IActionResult> List()
{
diff --git a/src/Web/Grand.Web.Admin/Controllers/CheckoutAttributeController.cs b/src/Web/Grand.Web.Admin/Controllers/CheckoutAttributeController.cs
index 67211f113..8045eabe4 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CheckoutAttributeController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CheckoutAttributeController.cs
@@ -58,9 +58,15 @@ namespace Grand.Web.Admin.Controllers
#region Checkout attributes
//list
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
- public IActionResult List() => View();
+ public IActionResult List()
+ {
+ return View();
+ }
[HttpPost]
[PermissionAuthorizeAction(PermissionActionName.List)]
diff --git a/src/Web/Grand.Web.Admin/Controllers/CollectionController.cs b/src/Web/Grand.Web.Admin/Controllers/CollectionController.cs
index e835b805e..7ef97a462 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CollectionController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CollectionController.cs
@@ -82,7 +82,10 @@ namespace Grand.Web.Admin.Controllers
#region List
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
public async Task<IActionResult> List()
{
diff --git a/src/Web/Grand.Web.Admin/Controllers/ContactAttributeController.cs b/src/Web/Grand.Web.Admin/Controllers/ContactAttributeController.cs
index 2a6b59c8c..7d30325e5 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ContactAttributeController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ContactAttributeController.cs
@@ -49,7 +49,10 @@ namespace Grand.Web.Admin.Controllers
return RedirectToAction("List");
}
- public IActionResult List() => View();
+ public IActionResult List()
+ {
+ return View();
+ }
[HttpPost]
[PermissionAuthorizeAction(PermissionActionName.List)]
diff --git a/src/Web/Grand.Web.Admin/Controllers/ContactFormController.cs b/src/Web/Grand.Web.Admin/Controllers/ContactFormController.cs
index 61d3496f0..cdb695bbc 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ContactFormController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ContactFormController.cs
@@ -25,7 +25,10 @@ namespace Grand.Web.Admin.Controllers
_translationService = translationService;
}
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
public async Task<IActionResult> List()
{
diff --git a/src/Web/Grand.Web.Admin/Controllers/CountryController.cs b/src/Web/Grand.Web.Admin/Controllers/CountryController.cs
index 663807b22..69e786ccc 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CountryController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CountryController.cs
@@ -51,7 +51,10 @@ namespace Grand.Web.Admin.Controllers
#region Countries
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
public IActionResult List()
{
diff --git a/src/Web/Grand.Web.Admin/Controllers/CourseController.cs b/src/Web/Grand.Web.Admin/Controllers/CourseController.cs
index 8bc5b7061..842b8ef9a 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CourseController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CourseController.cs
@@ -57,7 +57,10 @@ namespace Grand.Web.Admin.Controllers
#region Level
- public IActionResult Level() => View();
+ public IActionResult Level()
+ {
+ return View();
+ }
[PermissionAuthorizeAction(PermissionActionName.List)]
[HttpPost]
@@ -123,7 +126,10 @@ namespace Grand.Web.Admin.Controllers
#region Course
- public IActionResult List() => View();
+ public IActionResult List()
+ {
+ return View();
+ }
[PermissionAuthorizeAction(PermissionActionName.List)]
[HttpPost]
diff --git a/src/Web/Grand.Web.Admin/Controllers/CurrencyController.cs b/src/Web/Grand.Web.Admin/Controllers/CurrencyController.cs
index cbf3ea66f..d5936f601 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CurrencyController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CurrencyController.cs
@@ -68,7 +68,10 @@ namespace Grand.Web.Admin.Controllers
await _cacheBase.Clear();
}
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
[PermissionAuthorizeAction(PermissionActionName.List)]
public async Task<IActionResult> List(bool liveRates = false)
diff --git a/src/Web/Grand.Web.Admin/Controllers/CustomerAttributeController.cs b/src/Web/Grand.Web.Admin/Controllers/CustomerAttributeController.cs
index 14c4a0709..8e2f873c7 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CustomerAttributeController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CustomerAttributeController.cs
@@ -38,9 +38,15 @@ namespace Grand.Web.Admin.Controllers
#region Customer attributes
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
- public IActionResult List() => View();
+ public IActionResult List()
+ {
+ return View();
+ }
[HttpPost]
[PermissionAuthorizeAction(PermissionActionName.List)]
diff --git a/src/Web/Grand.Web.Admin/Controllers/CustomerController.cs b/src/Web/Grand.Web.Admin/Controllers/CustomerController.cs
index c4ece6983..3288f2c0b 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CustomerController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CustomerController.cs
@@ -181,7 +181,10 @@ namespace Grand.Web.Admin.Controllers
#region Customers
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
public async Task<IActionResult> List()
{
@@ -524,7 +527,7 @@ namespace Grand.Web.Admin.Controllers
{
var customer = await _customerService.GetCustomerById(customerId);
if (customer == null || customer.Deleted || await CheckSalesManager(customer))
- throw new ArgumentException("No customer found with the specified id", "customerId");
+ throw new ArgumentException("No customer found with the specified id", nameof(customerId));
var addresses = (await _customerViewModelService.PrepareAddressModel(customer)).ToList();
var gridModel = new DataSourceResult
@@ -542,7 +545,7 @@ namespace Grand.Web.Admin.Controllers
{
var customer = await _customerService.GetCustomerById(customerId);
if (customer == null || customer.Deleted || await CheckSalesManager(customer))
- throw new ArgumentException("No customer found with the specified id", "customerId");
+ throw new ArgumentException("No customer found with the specified id", nameof(customerId));
var address = customer.Addresses.FirstOrDefault(a => a.Id == id);
if (address == null)
@@ -737,7 +740,7 @@ namespace Grand.Web.Admin.Controllers
{
var productReview = await _productReviewService.GetProductReviewById(id);
if (productReview == null)
- throw new ArgumentException("No review found with the specified id", "id");
+ throw new ArgumentException("No review found with the specified id", nameof(id));
await _productReviewViewModelService.DeleteProductReview(productReview);
return new JsonResult("");
@@ -766,7 +769,7 @@ namespace Grand.Web.Admin.Controllers
{
var customer = await _customerService.GetCustomerById(customerId);
if (customer == null || customer.Deleted || await CheckSalesManager(customer))
- throw new ArgumentException("No customer found with the specified id", "customerId");
+ throw new ArgumentException("No customer found with the specified id", nameof(customerId));
var warnings = await _customerViewModelService.UpdateCart(customer, id, unitPriceValue);
if (warnings.Any())
@@ -780,7 +783,7 @@ namespace Grand.Web.Admin.Controllers
{
var customer = await _customerService.GetCustomerById(customerId);
if (customer == null || customer.Deleted || await CheckSalesManager(customer))
- throw new ArgumentException("No customer found with the specified id", "customerId");
+ throw new ArgumentException("No customer found with the specified id", nameof(customerId));
await _customerViewModelService.DeleteCart(customer, id);
diff --git a/src/Web/Grand.Web.Admin/Controllers/CustomerGroupController.cs b/src/Web/Grand.Web.Admin/Controllers/CustomerGroupController.cs
index a7f10bf34..a549688e9 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CustomerGroupController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CustomerGroupController.cs
@@ -51,7 +51,10 @@ namespace Grand.Web.Admin.Controllers
#region Customer groups
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
public IActionResult List()
{
diff --git a/src/Web/Grand.Web.Admin/Controllers/CustomerTagController.cs b/src/Web/Grand.Web.Admin/Controllers/CustomerTagController.cs
index 56e831622..544bbcdd5 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CustomerTagController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CustomerTagController.cs
@@ -37,9 +37,15 @@ namespace Grand.Web.Admin.Controllers
#region Customer Tags
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
- public IActionResult List() => View();
+ public IActionResult List()
+ {
+ return View();
+ }
[HttpPost]
[PermissionAuthorizeAction(PermissionActionName.List)]
diff --git a/src/Web/Grand.Web.Admin/Controllers/DiscountController.cs b/src/Web/Grand.Web.Admin/Controllers/DiscountController.cs
index c41f78e1d..7314ffe78 100644
--- a/src/Web/Grand.Web.Admin/Controllers/DiscountController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/DiscountController.cs
@@ -58,7 +58,10 @@ namespace Grand.Web.Admin.Controllers
#region Discounts
//list
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
public IActionResult List()
{
@@ -284,7 +287,7 @@ namespace Grand.Web.Admin.Controllers
public async Task<IActionResult> GetDiscountRequirementConfigurationUrl(string rulesystemName, string discountId, string discountRequirementId)
{
if (string.IsNullOrEmpty(rulesystemName))
- throw new ArgumentNullException("rulesystemName");
+ throw new ArgumentNullException(nameof(rulesystemName));
var discountPlugin = _discountService.LoadDiscountProviderByRuleSystemName(rulesystemName);
diff --git a/src/Web/Grand.Web.Admin/Controllers/DocumentController.cs b/src/Web/Grand.Web.Admin/Controllers/DocumentController.cs
index 2c3ece7e9..6a0575cfe 100644
--- a/src/Web/Grand.Web.Admin/Controllers/DocumentController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/DocumentController.cs
@@ -34,9 +34,15 @@ namespace Grand.Web.Admin.Controllers
_customerService = customerService;
}
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
- public IActionResult List() => View(new DocumentListModel());
+ public IActionResult List()
+ {
+ return View(new DocumentListModel());
+ }
[PermissionAuthorizeAction(PermissionActionName.List)]
public async Task<IActionResult> ListDocuments(DataSourceRequest command, DocumentListModel model)
@@ -134,7 +140,10 @@ namespace Grand.Web.Admin.Controllers
#region Document type
- public IActionResult Types() => View();
+ public IActionResult Types()
+ {
+ return View();
+ }
[PermissionAuthorizeAction(PermissionActionName.List)]
public async Task<IActionResult> ListType()
diff --git a/src/Web/Grand.Web.Admin/Controllers/EmailAccountController.cs b/src/Web/Grand.Web.Admin/Controllers/EmailAccountController.cs
index e13936fb0..287a6ff50 100644
--- a/src/Web/Grand.Web.Admin/Controllers/EmailAccountController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/EmailAccountController.cs
@@ -37,7 +37,10 @@ namespace Grand.Web.Admin.Controllers
_cacheBase = cacheBase;
}
- public IActionResult List() => View();
+ public IActionResult List()
+ {
+ return View();
+ }
[HttpPost]
[PermissionAuthorizeAction(PermissionActionName.List)]
diff --git a/src/Web/Grand.Web.Admin/Controllers/ExternalAuthenticationController.cs b/src/Web/Grand.Web.Admin/Controllers/ExternalAuthenticationController.cs
index f8bc9a6da..5c834ddc8 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ExternalAuthenticationController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ExternalAuthenticationController.cs
@@ -41,7 +41,10 @@ namespace Grand.Web.Admin.Controllers
#region Methods
- public IActionResult Methods() => View();
+ public IActionResult Methods()
+ {
+ return View();
+ }
[HttpPost]
public IActionResult Methods(DataSourceRequest command)
diff --git a/src/Web/Grand.Web.Admin/Controllers/GiftVoucherController.cs b/src/Web/Grand.Web.Admin/Controllers/GiftVoucherController.cs
index 0706c8382..36c30aeeb 100644
--- a/src/Web/Grand.Web.Admin/Controllers/GiftVoucherController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/GiftVoucherController.cs
@@ -36,7 +36,10 @@ namespace Grand.Web.Admin.Controllers
#region Methods
//list
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
public IActionResult List()
{
diff --git a/src/Web/Grand.Web.Admin/Controllers/KnowledgebaseController.cs b/src/Web/Grand.Web.Admin/Controllers/KnowledgebaseController.cs
index a2fd8e338..d9edde49b 100644
--- a/src/Web/Grand.Web.Admin/Controllers/KnowledgebaseController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/KnowledgebaseController.cs
@@ -33,9 +33,15 @@ namespace Grand.Web.Admin.Controllers
_languageService = languageService;
}
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
- public IActionResult List() => View();
+ public IActionResult List()
+ {
+ return View();
+ }
public async Task<IActionResult> NodeList()
{
diff --git a/src/Web/Grand.Web.Admin/Controllers/LanguageController.cs b/src/Web/Grand.Web.Admin/Controllers/LanguageController.cs
index 6a7eb1cdd..d8f1d3402 100644
--- a/src/Web/Grand.Web.Admin/Controllers/LanguageController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/LanguageController.cs
@@ -40,9 +40,15 @@ namespace Grand.Web.Admin.Controllers
#region Languages
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
- public IActionResult List() => View();
+ public IActionResult List()
+ {
+ return View();
+ }
[PermissionAuthorizeAction(PermissionActionName.List)]
[HttpPost]
diff --git a/src/Web/Grand.Web.Admin/Controllers/LayoutController.cs b/src/Web/Grand.Web.Admin/Controllers/LayoutController.cs
index 92734eb54..5ed979ddb 100644
--- a/src/Web/Grand.Web.Admin/Controllers/LayoutController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/LayoutController.cs
@@ -46,7 +46,10 @@ namespace Grand.Web.Admin.Controllers
#region Category layouts
- public IActionResult CategoryLayouts() => View();
+ public IActionResult CategoryLayouts()
+ {
+ return View();
+ }
[HttpPost]
public async Task<IActionResult> CategoryLayouts(DataSourceRequest command)
@@ -121,7 +124,10 @@ namespace Grand.Web.Admin.Controllers
#region Brand layouts
- public IActionResult BrandLayouts() => View();
+ public IActionResult BrandLayouts()
+ {
+ return View();
+ }
[HttpPost]
public async Task<IActionResult> BrandLayouts(DataSourceRequest command)
@@ -191,7 +197,10 @@ namespace Grand.Web.Admin.Controllers
#endregion
#region Collection layouts
- public IActionResult CollectionLayouts() => View();
+ public IActionResult CollectionLayouts()
+ {
+ return View();
+ }
[HttpPost]
public async Task<IActionResult> CollectionLayouts(DataSourceRequest command)
@@ -262,7 +271,10 @@ namespace Grand.Web.Admin.Controllers
#region Product layouts
- public IActionResult ProductLayouts() => View();
+ public IActionResult ProductLayouts()
+ {
+ return View();
+ }
[HttpPost]
public async Task<IActionResult> ProductLayouts(DataSourceRequest command)
@@ -329,7 +341,10 @@ namespace Grand.Web.Admin.Controllers
#region Page layouts
- public IActionResult PageLayouts() => View();
+ public IActionResult PageLayouts()
+ {
+ return View();
+ }
[HttpPost]
public async Task<IActionResult> PageLayouts(DataSourceRequest command)
diff --git a/src/Web/Grand.Web.Admin/Controllers/MeasureController.cs b/src/Web/Grand.Web.Admin/Controllers/MeasureController.cs
index 285ea7b01..58d397dcc 100644
--- a/src/Web/Grand.Web.Admin/Controllers/MeasureController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/MeasureController.cs
@@ -49,7 +49,10 @@ namespace Grand.Web.Admin.Controllers
await _cacheBase.Clear();
}
- public IActionResult Index() => View();
+ public IActionResult Index()
+ {
+ return View();
+ }
#region Weights
diff --git a/src/Web/Grand.Web.Admin/Controllers/MenuController.cs b/src/Web/Grand.Web.Admin/Controllers/MenuController.cs
index 874137049..b5cb54f7c 100644
--- a/src/Web/Grand.Web.Admin/Controllers/MenuController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/MenuController.cs
@@ -34,7 +34,10 @@ public class MenuController : BaseAdminController
#region Methods
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
[HttpGet]
public IActionResult List()
diff --git a/src/Web/Grand.Web.Admin/Controllers/MerchandiseReturnController.cs b/src/Web/Grand.Web.Admin/Controllers/MerchandiseReturnController.cs
index eb0611110..8498af341 100644
--- a/src/Web/Grand.Web.Admin/Controllers/MerchandiseReturnController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/MerchandiseReturnController.cs
@@ -53,7 +53,10 @@ namespace Grand.Web.Admin.Controllers
#region Methods
//list
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
public IActionResult List()
{
diff --git a/src/Web/Grand.Web.Admin/Controllers/MessageTemplateController.cs b/src/Web/Grand.Web.Admin/Controllers/MessageTemplateController.cs
index a15078b7e..ef6bd2f7f 100644
--- a/src/Web/Grand.Web.Admin/Controllers/MessageTemplateController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/MessageTemplateController.cs
@@ -56,7 +56,10 @@ namespace Grand.Web.Admin.Controllers
#region Methods
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
public async Task<IActionResult> List()
{
diff --git a/src/Web/Grand.Web.Admin/Controllers/NewsController.cs b/src/Web/Grand.Web.Admin/Controllers/NewsController.cs
index 2dac0bea7..15ac52b24 100644
--- a/src/Web/Grand.Web.Admin/Controllers/NewsController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/NewsController.cs
@@ -51,7 +51,10 @@ namespace Grand.Web.Admin.Controllers
#region News items
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
public async Task<IActionResult> List()
{
diff --git a/src/Web/Grand.Web.Admin/Controllers/NewsLetterCategoryController.cs b/src/Web/Grand.Web.Admin/Controllers/NewsLetterCategoryController.cs
index b132e77f4..f2a8f895e 100644
--- a/src/Web/Grand.Web.Admin/Controllers/NewsLetterCategoryController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/NewsLetterCategoryController.cs
@@ -38,9 +38,15 @@ namespace Grand.Web.Admin.Controllers
#region Methods
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
- public IActionResult List() => View();
+ public IActionResult List()
+ {
+ return View();
+ }
[PermissionAuthorizeAction(PermissionActionName.List)]
[HttpPost]
diff --git a/src/Web/Grand.Web.Admin/Controllers/NewsLetterSubscriptionController.cs b/src/Web/Grand.Web.Admin/Controllers/NewsLetterSubscriptionController.cs
index 555365d2e..9c8354f0a 100644
--- a/src/Web/Grand.Web.Admin/Controllers/NewsLetterSubscriptionController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/NewsLetterSubscriptionController.cs
@@ -66,7 +66,10 @@ namespace Grand.Web.Admin.Controllers
}
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
public async Task<IActionResult> List()
{
diff --git a/src/Web/Grand.Web.Admin/Controllers/OnlineCustomerController.cs b/src/Web/Grand.Web.Admin/Controllers/OnlineCustomerController.cs
index c8f7cf175..c6f2c9341 100644
--- a/src/Web/Grand.Web.Admin/Controllers/OnlineCustomerController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/OnlineCustomerController.cs
@@ -46,7 +46,10 @@ namespace Grand.Web.Admin.Controllers
#region Methods
- public IActionResult List() => View();
+ public IActionResult List()
+ {
+ return View();
+ }
[HttpPost]
[PermissionAuthorizeAction(PermissionActionName.List)]
diff --git a/src/Web/Grand.Web.Admin/Controllers/OrderController.cs b/src/Web/Grand.Web.Admin/Controllers/OrderController.cs
index 67d840fdb..b6706f875 100644
--- a/src/Web/Grand.Web.Admin/Controllers/OrderController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/OrderController.cs
@@ -55,7 +55,10 @@ namespace Grand.Web.Admin.Controllers
#region Order list
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
public async Task<IActionResult> List(int? orderStatusId = null,
int? paymentStatusId = null, int? shippingStatusId = null, DateTime? startDate = null, string code = null)
@@ -942,7 +945,7 @@ namespace Grand.Web.Admin.Controllers
}
if (address == null)
- throw new ArgumentException("No address found with the specified id", "addressId");
+ throw new ArgumentException("No address found with the specified id", nameof(addressId));
var model = await orderViewModelService.PrepareOrderAddressModel(order, address);
model.BillingAddress = billingAddress;
diff --git a/src/Web/Grand.Web.Admin/Controllers/OrderStatusController.cs b/src/Web/Grand.Web.Admin/Controllers/OrderStatusController.cs
index eae1c2dbd..c4b6ee480 100644
--- a/src/Web/Grand.Web.Admin/Controllers/OrderStatusController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/OrderStatusController.cs
@@ -32,7 +32,10 @@ namespace Grand.Web.Admin.Controllers
#region Delivery dates
- public IActionResult Index() => View();
+ public IActionResult Index()
+ {
+ return View();
+ }
[HttpPost]
public async Task<IActionResult> Statuses()
diff --git a/src/Web/Grand.Web.Admin/Controllers/PageController.cs b/src/Web/Grand.Web.Admin/Controllers/PageController.cs
index 73bf9a9ce..699bc2714 100644
--- a/src/Web/Grand.Web.Admin/Controllers/PageController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/PageController.cs
@@ -50,7 +50,10 @@ namespace Grand.Web.Admin.Controllers
#region List
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
public async Task<IActionResult> List()
{
diff --git a/src/Web/Grand.Web.Admin/Controllers/PaymentController.cs b/src/Web/Grand.Web.Admin/Controllers/PaymentController.cs
index 7e62d437f..aa8a61cd8 100644
--- a/src/Web/Grand.Web.Admin/Controllers/PaymentController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/PaymentController.cs
@@ -56,7 +56,10 @@ namespace Grand.Web.Admin.Controllers
#region Methods
- public IActionResult Index() => View();
+ public IActionResult Index()
+ {
+ return View();
+ }
[HttpPost]
public async Task<IActionResult> Methods()
diff --git a/src/Web/Grand.Web.Admin/Controllers/PaymentTransactionController.cs b/src/Web/Grand.Web.Admin/Controllers/PaymentTransactionController.cs
index 7169201fe..9b863feda 100644
--- a/src/Web/Grand.Web.Admin/Controllers/PaymentTransactionController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/PaymentTransactionController.cs
@@ -60,7 +60,10 @@ namespace Grand.Web.Admin.Controllers
#region Methods
//list
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
public IActionResult List()
{
diff --git a/src/Web/Grand.Web.Admin/Controllers/PluginController.cs b/src/Web/Grand.Web.Admin/Controllers/PluginController.cs
index 999f1c9d6..1c901724d 100644
--- a/src/Web/Grand.Web.Admin/Controllers/PluginController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/PluginController.cs
@@ -103,7 +103,10 @@ namespace Grand.Web.Admin.Controllers
#region Methods
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
public IActionResult List()
{
@@ -335,7 +338,7 @@ namespace Grand.Web.Admin.Controllers
if (rootDirectories.Count != 1)
{
throw new Exception(
- $"The archive should contain only one root plugin. For example, Payments.PayPalDirect.");
+ "The archive should contain only one root plugin. For example, Payments.PayPalDirect.");
}
//get directory name (remove the ending /)
@@ -392,7 +395,7 @@ namespace Grand.Web.Admin.Controllers
throw new Exception("No info file is found.");
if (string.IsNullOrEmpty(uploadedItemDirectoryName))
- throw new Exception($"Cannot get the plugin directory name");
+ throw new Exception("Cannot get the plugin directory name");
var pathToUpload = Path.Combine(pluginsDirectory, uploadedItemDirectoryName);
diff --git a/src/Web/Grand.Web.Admin/Controllers/ProductAttributeController.cs b/src/Web/Grand.Web.Admin/Controllers/ProductAttributeController.cs
index e3d99f804..cf18ff60c 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ProductAttributeController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ProductAttributeController.cs
@@ -55,9 +55,15 @@ namespace Grand.Web.Admin.Controllers
#region Attribute list / create / edit / delete
//list
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
- public IActionResult List() => View();
+ public IActionResult List()
+ {
+ return View();
+ }
[PermissionAuthorizeAction(PermissionActionName.List)]
[HttpPost]
diff --git a/src/Web/Grand.Web.Admin/Controllers/ProductController.cs b/src/Web/Grand.Web.Admin/Controllers/ProductController.cs
index 86e8fc183..f53a299b7 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ProductController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ProductController.cs
@@ -95,7 +95,10 @@ namespace Grand.Web.Admin.Controllers
#region Product list / create / edit / delete
//list products
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
public async Task<IActionResult> List()
{
diff --git a/src/Web/Grand.Web.Admin/Controllers/ProductReviewController.cs b/src/Web/Grand.Web.Admin/Controllers/ProductReviewController.cs
index f8349437f..af2409d76 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ProductReviewController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ProductReviewController.cs
@@ -46,7 +46,10 @@ namespace Grand.Web.Admin.Controllers
#region Methods
//list
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
public async Task<IActionResult> List()
{
diff --git a/src/Web/Grand.Web.Admin/Controllers/ProductTagsController.cs b/src/Web/Grand.Web.Admin/Controllers/ProductTagsController.cs
index 3717f6396..7f85f6cbb 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ProductTagsController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ProductTagsController.cs
@@ -34,9 +34,15 @@ namespace Grand.Web.Admin.Controllers
_seoSettings = seoSettings;
}
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
- public IActionResult List() => View();
+ public IActionResult List()
+ {
+ return View();
+ }
[PermissionAuthorizeAction(PermissionActionName.List)]
[HttpPost]
diff --git a/src/Web/Grand.Web.Admin/Controllers/QueuedEmailController.cs b/src/Web/Grand.Web.Admin/Controllers/QueuedEmailController.cs
index ae5378933..fdce2b656 100644
--- a/src/Web/Grand.Web.Admin/Controllers/QueuedEmailController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/QueuedEmailController.cs
@@ -61,7 +61,10 @@ namespace Grand.Web.Admin.Controllers
};
}
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
[PermissionAuthorizeAction(PermissionActionName.List)]
public IActionResult List()
diff --git a/src/Web/Grand.Web.Admin/Controllers/SalesEmployeeController.cs b/src/Web/Grand.Web.Admin/Controllers/SalesEmployeeController.cs
index 9c4050d50..192766398 100644
--- a/src/Web/Grand.Web.Admin/Controllers/SalesEmployeeController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/SalesEmployeeController.cs
@@ -43,7 +43,10 @@ namespace Grand.Web.Admin.Controllers
#endregion
[PermissionAuthorizeAction(PermissionActionName.List)]
- public IActionResult Index() => View();
+ public IActionResult Index()
+ {
+ return View();
+ }
[HttpPost]
[PermissionAuthorizeAction(PermissionActionName.List)]
diff --git a/src/Web/Grand.Web.Admin/Controllers/ScheduleTaskController.cs b/src/Web/Grand.Web.Admin/Controllers/ScheduleTaskController.cs
index 3424ad96f..bfb1ff5ad 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ScheduleTaskController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ScheduleTaskController.cs
@@ -62,9 +62,15 @@ namespace Grand.Web.Admin.Controllers
#endregion
#region Methods
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
- public IActionResult List() => View();
+ public IActionResult List()
+ {
+ return View();
+ }
[PermissionAuthorizeAction(PermissionActionName.List)]
[HttpPost]
diff --git a/src/Web/Grand.Web.Admin/Controllers/ShippingController.cs b/src/Web/Grand.Web.Admin/Controllers/ShippingController.cs
index 66e53b193..9d89d6bc2 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ShippingController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ShippingController.cs
@@ -135,7 +135,10 @@ namespace Grand.Web.Admin.Controllers
#region Shipping rate methods
- public IActionResult Providers() => View();
+ public IActionResult Providers()
+ {
+ return View();
+ }
[HttpPost]
public async Task<IActionResult> Providers(DataSourceRequest command)
@@ -194,7 +197,10 @@ namespace Grand.Web.Admin.Controllers
#region Shipping methods
- public IActionResult Methods() => View();
+ public IActionResult Methods()
+ {
+ return View();
+ }
[HttpPost]
public async Task<IActionResult> Methods(DataSourceRequest command)
@@ -348,7 +354,10 @@ namespace Grand.Web.Admin.Controllers
#region Delivery dates
- public IActionResult DeliveryDates() => View();
+ public IActionResult DeliveryDates()
+ {
+ return View();
+ }
[HttpPost]
public async Task<IActionResult> DeliveryDates(DataSourceRequest command)
@@ -458,7 +467,10 @@ namespace Grand.Web.Admin.Controllers
#region Warehouses
- public IActionResult Warehouses() => View();
+ public IActionResult Warehouses()
+ {
+ return View();
+ }
[HttpPost]
public async Task<IActionResult> Warehouses(DataSourceRequest command)
@@ -551,7 +563,10 @@ namespace Grand.Web.Admin.Controllers
#region PickupPoints
- public IActionResult PickupPoints() => View();
+ public IActionResult PickupPoints()
+ {
+ return View();
+ }
[HttpPost]
public async Task<IActionResult> PickupPoints(DataSourceRequest command)
diff --git a/src/Web/Grand.Web.Admin/Controllers/ShoppingCartController.cs b/src/Web/Grand.Web.Admin/Controllers/ShoppingCartController.cs
index 7c3cf76e3..cfc35568e 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ShoppingCartController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ShoppingCartController.cs
@@ -58,7 +58,10 @@ namespace Grand.Web.Admin.Controllers
#region Methods
//shopping carts
- public IActionResult CurrentCarts() => View();
+ public IActionResult CurrentCarts()
+ {
+ return View();
+ }
[HttpPost]
public async Task<IActionResult> CurrentCarts(DataSourceRequest command)
diff --git a/src/Web/Grand.Web.Admin/Controllers/SpecificationAttributeController.cs b/src/Web/Grand.Web.Admin/Controllers/SpecificationAttributeController.cs
index 9dc05c930..cecad2040 100644
--- a/src/Web/Grand.Web.Admin/Controllers/SpecificationAttributeController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/SpecificationAttributeController.cs
@@ -54,9 +54,15 @@ namespace Grand.Web.Admin.Controllers
#region Specification attributes
//list
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
- public IActionResult List() => View();
+ public IActionResult List()
+ {
+ return View();
+ }
[HttpPost]
[PermissionAuthorizeAction(PermissionActionName.List)]
diff --git a/src/Web/Grand.Web.Admin/Controllers/StoreController.cs b/src/Web/Grand.Web.Admin/Controllers/StoreController.cs
index e83e08709..e829aa8a7 100644
--- a/src/Web/Grand.Web.Admin/Controllers/StoreController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/StoreController.cs
@@ -32,7 +32,10 @@ namespace Grand.Web.Admin.Controllers
_translationService = translationService;
}
- public IActionResult List() => View();
+ public IActionResult List()
+ {
+ return View();
+ }
[HttpPost]
[PermissionAuthorizeAction(PermissionActionName.List)]
diff --git a/src/Web/Grand.Web.Admin/Controllers/TaxController.cs b/src/Web/Grand.Web.Admin/Controllers/TaxController.cs
index 12ae3fe3b..f1a4aa450 100644
--- a/src/Web/Grand.Web.Admin/Controllers/TaxController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/TaxController.cs
@@ -61,7 +61,10 @@ namespace Grand.Web.Admin.Controllers
await _cacheBase.Clear();
}
- public IActionResult Providers() => View();
+ public IActionResult Providers()
+ {
+ return View();
+ }
[HttpPost]
public async Task<IActionResult> Providers(DataSourceRequest command)
@@ -188,7 +191,10 @@ namespace Grand.Web.Admin.Controllers
#region Tax Categories
- public IActionResult Categories() => View();
+ public IActionResult Categories()
+ {
+ return View();
+ }
[HttpPost]
public async Task<IActionResult> Categories(DataSourceRequest command)
diff --git a/src/Web/Grand.Web.Admin/Controllers/VendorController.cs b/src/Web/Grand.Web.Admin/Controllers/VendorController.cs
index 72f491c2d..2a63db9e7 100644
--- a/src/Web/Grand.Web.Admin/Controllers/VendorController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/VendorController.cs
@@ -49,7 +49,10 @@ namespace Grand.Web.Admin.Controllers
#region Methods
//list
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
public IActionResult List()
{
diff --git a/src/Web/Grand.Web.Admin/Controllers/VendorReviewController.cs b/src/Web/Grand.Web.Admin/Controllers/VendorReviewController.cs
index d91a33f5c..f6af12b1a 100644
--- a/src/Web/Grand.Web.Admin/Controllers/VendorReviewController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/VendorReviewController.cs
@@ -46,7 +46,10 @@ namespace Grand.Web.Admin.Controllers
#region Methods
//list
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
public IActionResult List()
{
diff --git a/src/Web/Grand.Web.Admin/Controllers/WidgetController.cs b/src/Web/Grand.Web.Admin/Controllers/WidgetController.cs
index fad3e8a97..ba4317073 100644
--- a/src/Web/Grand.Web.Admin/Controllers/WidgetController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/WidgetController.cs
@@ -45,9 +45,15 @@ namespace Grand.Web.Admin.Controllers
#region Methods
- public IActionResult Index() => RedirectToAction("List");
+ public IActionResult Index()
+ {
+ return RedirectToAction("List");
+ }
- public IActionResult List() => View();
+ public IActionResult List()
+ {
+ return View();
+ }
[PermissionAuthorizeAction(PermissionActionName.List)]
[HttpPost]
diff --git a/src/Web/Grand.Web.Admin/Endpoints/EndpointProvider.cs b/src/Web/Grand.Web.Admin/Endpoints/EndpointProvider.cs
index 7aba0d0b4..9e10da98b 100644
--- a/src/Web/Grand.Web.Admin/Endpoints/EndpointProvider.cs
+++ b/src/Web/Grand.Web.Admin/Endpoints/EndpointProvider.cs
@@ -16,10 +16,10 @@ namespace Grand.Web.Admin.Endpoints
pattern: $"{Constants.AreaAdmin}/{{controller=Home}}/{{action=Index}}/{{id?}}");
//admin index
- endpointRouteBuilder.MapControllerRoute("AdminIndex", $"admin/", new { controller = "Home", action = "Index", area = Constants.AreaAdmin });
+ endpointRouteBuilder.MapControllerRoute("AdminIndex", "admin/", new { controller = "Home", action = "Index", area = Constants.AreaAdmin });
//admin login
- endpointRouteBuilder.MapControllerRoute("AdminLogin", $"admin/login/", new { controller = "Login", action = "Index", area = Constants.AreaAdmin });
+ endpointRouteBuilder.MapControllerRoute("AdminLogin", "admin/login/", new { controller = "Login", action = "Index", area = Constants.AreaAdmin });
}
public int Priority => 10;
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/ProductReviewModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/ProductReviewModel.cs
index 4c1bae727..03872a954 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/ProductReviewModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/ProductReviewModel.cs
@@ -10,11 +10,7 @@ namespace Grand.Web.Admin.Models.Catalog
[GrandResourceDisplayName("Admin.Catalog.ProductReviews.Fields.Product")]
public string ProductName { get; set; }
- public string Ids {
- get {
- return Id + ":" + ProductId;
- }
- }
+ public string Ids => Id + ":" + ProductId;
[GrandResourceDisplayName("Admin.Catalog.ProductReviews.Fields.Store")]
public string StoreName { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Vendors/VendorReviewModel.cs b/src/Web/Grand.Web.Admin/Models/Vendors/VendorReviewModel.cs
index e3a8eca7a..f817cfb72 100644
--- a/src/Web/Grand.Web.Admin/Models/Vendors/VendorReviewModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Vendors/VendorReviewModel.cs
@@ -10,11 +10,8 @@ namespace Grand.Web.Admin.Models.Vendors
[GrandResourceDisplayName("Admin.VendorReviews.Fields.Vendor")]
public string VendorName { get; set; }
- public string Ids {
- get {
- return Id + ":" + VendorId;
- }
- }
+ public string Ids => Id + ":" + VendorId;
+
[GrandResourceDisplayName("Admin.VendorReviews.Fields.Customer")]
public string CustomerId { get; set; }
[GrandResourceDisplayName("Admin.VendorReviews.Fields.Customer")]
diff --git a/src/Web/Grand.Web.Admin/Services/ElFinderViewModelService.cs b/src/Web/Grand.Web.Admin/Services/ElFinderViewModelService.cs
index 06fbb1cb7..ff970a1fa 100644
--- a/src/Web/Grand.Web.Admin/Services/ElFinderViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/ElFinderViewModelService.cs
@@ -54,7 +54,7 @@ namespace Grand.Web.Admin.Services
}
_fullPathToUpload = uploaded.PhysicalPath;
- _urlpathUploded = (string.IsNullOrEmpty(CommonPath.Param) ? $"/": $"/{CommonPath.Param}/")
+ _urlpathUploded = (string.IsNullOrEmpty(CommonPath.Param) ? "/": $"/{CommonPath.Param}/")
+ uploaded.Path.Replace("\\", "/") + "/";
var thumbs = _mediaFileStore.GetDirectoryInfo(CommonPath.ImageThumbPath);
diff --git a/src/Web/Grand.Web.Common/Middleware/InstallUrlMiddleware.cs b/src/Web/Grand.Web.Common/Middleware/InstallUrlMiddleware.cs
index 71d443aed..8312a3324 100644
--- a/src/Web/Grand.Web.Common/Middleware/InstallUrlMiddleware.cs
+++ b/src/Web/Grand.Web.Common/Middleware/InstallUrlMiddleware.cs
@@ -33,7 +33,7 @@ namespace Grand.Web.Common.Middleware
//whether database is installed
if (!DataSettingsManager.DatabaseIsInstalled())
{
- const string installUrl = $"/install";
+ const string installUrl = "/install";
if (!context.Request.GetEncodedPathAndQuery().StartsWith(installUrl, StringComparison.OrdinalIgnoreCase))
{
//redirect
diff --git a/src/Web/Grand.Web.Common/Page/PageHeadBuilder.cs b/src/Web/Grand.Web.Common/Page/PageHeadBuilder.cs
index 4fb119b34..a5a4fd6d5 100644
--- a/src/Web/Grand.Web.Common/Page/PageHeadBuilder.cs
+++ b/src/Web/Grand.Web.Common/Page/PageHeadBuilder.cs
@@ -210,8 +210,8 @@ namespace Grand.Web.Common.Page
public virtual string EditPageUrl
{
- get { return _editPageUrl; }
- set { _editPageUrl = value; }
+ get => _editPageUrl;
+ set => _editPageUrl = value;
}
#endregion
diff --git a/src/Web/Grand.Web.Common/Security/Captcha/GoogleRecaptchaControl.cs b/src/Web/Grand.Web.Common/Security/Captcha/GoogleRecaptchaControl.cs
index 608ab6468..b653edc38 100644
--- a/src/Web/Grand.Web.Common/Security/Captcha/GoogleRecaptchaControl.cs
+++ b/src/Web/Grand.Web.Common/Security/Captcha/GoogleRecaptchaControl.cs
@@ -69,7 +69,7 @@ namespace Grand.Web.Common.Security.Captcha
script.AppendLine("grecaptcha.ready(function() {");
- script.AppendLine($" grecaptcha.execute(clientId, {{");
+ script.AppendLine(" grecaptcha.execute(clientId, {");
script.AppendLine(" action: 'homepage'");
script.AppendLine(" })");
script.AppendLine(" .then(function(token) {");
diff --git a/src/Web/Grand.Web.Common/TagHelpers/Admin/AdminInputTagHelper.cs b/src/Web/Grand.Web.Common/TagHelpers/Admin/AdminInputTagHelper.cs
index 3767e4146..106d84dad 100644
--- a/src/Web/Grand.Web.Common/TagHelpers/Admin/AdminInputTagHelper.cs
+++ b/src/Web/Grand.Web.Common/TagHelpers/Admin/AdminInputTagHelper.cs
@@ -124,10 +124,10 @@ namespace Grand.Web.Common.TagHelpers.Admin
if (disabled)
{
if(htmlAttributes == null)
- htmlAttributes = new { @disabled = "disabled" };
+ htmlAttributes = new { disabled = "disabled" };
else
{
- htmlAttributes = new { @class = "form-control k-input", @disabled = "disabled" };
+ htmlAttributes = new { @class = "form-control k-input", disabled = "disabled" };
}
}
var viewEngine = GetPrivateFieldValue(_htmlHelper, "_viewEngine") as IViewEngine;
diff --git a/src/Web/Grand.Web.Common/TagHelpers/Admin/AdminTabStripTagHelper.cs b/src/Web/Grand.Web.Common/TagHelpers/Admin/AdminTabStripTagHelper.cs
index fcf80ceba..eb800ffac 100644
--- a/src/Web/Grand.Web.Common/TagHelpers/Admin/AdminTabStripTagHelper.cs
+++ b/src/Web/Grand.Web.Common/TagHelpers/Admin/AdminTabStripTagHelper.cs
@@ -52,7 +52,7 @@ namespace Grand.Web.Common.TagHelpers.Admin
sb.AppendLine($"$('#{Name}').show();");
sb.AppendLine($"var tab_{rnd} = $('#{Name}').kendoTabStrip({{ ");
sb.AppendLine($" tabPosition: '{(SetTabPos ? "left" : "top")}',");
- sb.AppendLine($" animation: {{ open: {{ effects: 'fadeIn'}} }},");
+ sb.AppendLine(" animation: { open: { effects: 'fadeIn'} },");
sb.AppendLine(" select: tabstrip_on_tab_select,");
if (BindGrid)
sb.AppendLine(" show: tabstrip_on_tab_show");
diff --git a/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/DefaultHtmlGenerator.cs b/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/DefaultHtmlGenerator.cs
index eeacb0ac5..02d1e6b7e 100644
--- a/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/DefaultHtmlGenerator.cs
+++ b/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/DefaultHtmlGenerator.cs
@@ -673,7 +673,7 @@ namespace Grand.Web.Common.TagHelpers.Admin.Extend
if (columns < 0)
{
- throw new ArgumentOutOfRangeException($" nameof(columns) TextAreaParameterOutOfRange");
+ throw new ArgumentOutOfRangeException(" nameof(columns) TextAreaParameterOutOfRange");
}
var fullName = NameAndIdProvider.GetFullHtmlFieldName(viewContext, expression);
@@ -686,7 +686,7 @@ namespace Grand.Web.Common.TagHelpers.Admin.Extend
viewContext.ViewData.ModelState.TryGetValue(fullName, out var entry);
var value = string.Empty;
- if (entry != null && entry.AttemptedValue != null)
+ if (entry is { AttemptedValue: not null })
{
value = entry.AttemptedValue;
}
@@ -721,7 +721,7 @@ namespace Grand.Web.Common.TagHelpers.Admin.Extend
AddValidationAttributes(viewContext, tagBuilder, modelExplorer, expression);
// If there are any errors for a named field, we add this CSS attribute.
- if (entry != null && entry.Errors.Count > 0)
+ if (entry is { Errors.Count: > 0 })
{
tagBuilder.AddCssClass(HtmlHelper.ValidationInputCssClassName);
}
diff --git a/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/TemplateBuilder.cs b/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/TemplateBuilder.cs
index 5643e75ba..6f81e2c5e 100644
--- a/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/TemplateBuilder.cs
+++ b/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/TemplateBuilder.cs
@@ -91,11 +91,11 @@ namespace Grand.Web.Common.TagHelpers.Admin.Extend
}
// Create VDD of type object so any model type is allowed.
- var viewData = new ViewDataDictionary<object>(_viewData);
-
- // Create a new ModelExplorer in order to preserve the model metadata of the original _viewData even
- // though _model may have been reset to null. Otherwise we might lose track of the model type /property.
- viewData.ModelExplorer = _modelExplorer.GetExplorerForModel(_model);
+ var viewData = new ViewDataDictionary<object>(_viewData) {
+ // Create a new ModelExplorer in order to preserve the model metadata of the original _viewData even
+ // though _model may have been reset to null. Otherwise we might lose track of the model type /property.
+ ModelExplorer = _modelExplorer.GetExplorerForModel(_model)
+ };
var formatString = _readOnly ?
viewData.ModelMetadata.DisplayFormatString :
diff --git a/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/ViewBuffer.cs b/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/ViewBuffer.cs
index 04c05b31c..f5847ec86 100644
--- a/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/ViewBuffer.cs
+++ b/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/ViewBuffer.cs
@@ -256,7 +256,10 @@ namespace Grand.Web.Common.TagHelpers.Admin.Extend
}
}
- private string DebuggerToString() => _name;
+ private string DebuggerToString()
+ {
+ return _name;
+ }
public void CopyTo(IHtmlContentBuilder destination)
{
diff --git a/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/ViewBufferPage.cs b/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/ViewBufferPage.cs
index 9c3e41ec7..f789e22bb 100644
--- a/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/ViewBufferPage.cs
+++ b/src/Web/Grand.Web.Common/TagHelpers/Admin/Extend/ViewBufferPage.cs
@@ -23,6 +23,9 @@ namespace Grand.Web.Common.TagHelpers.Admin.Extend
// Very common trivial method; nudge it to inline https://github.com/aspnet/Mvc/pull/8339
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public void Append(ViewBufferValue value) => Buffer[Count++] = value;
+ public void Append(ViewBufferValue value)
+ {
+ Buffer[Count++] = value;
+ }
}
}
diff --git a/src/Web/Grand.Web.Common/TagHelpers/LinkEntry.cs b/src/Web/Grand.Web.Common/TagHelpers/LinkEntry.cs
index dbc3c625c..0cc931089 100644
--- a/src/Web/Grand.Web.Common/TagHelpers/LinkEntry.cs
+++ b/src/Web/Grand.Web.Common/TagHelpers/LinkEntry.cs
@@ -24,7 +24,7 @@ namespace Grand.Web.Common.TagHelpers
_builder.Attributes.TryGetValue("rel", out value);
return value;
}
- set { SetAttribute("rel", value); }
+ set => SetAttribute("rel", value);
}
public string Type
@@ -35,7 +35,7 @@ namespace Grand.Web.Common.TagHelpers
_builder.Attributes.TryGetValue("type", out value);
return value;
}
- set { SetAttribute("type", value); }
+ set => SetAttribute("type", value);
}
public string Title
@@ -46,7 +46,7 @@ namespace Grand.Web.Common.TagHelpers
_builder.Attributes.TryGetValue("title", out value);
return value;
}
- set { SetAttribute("title", value); }
+ set => SetAttribute("title", value);
}
public string Href
@@ -57,13 +57,13 @@ namespace Grand.Web.Common.TagHelpers
_builder.Attributes.TryGetValue("href", out value);
return value;
}
- set { SetAttribute("href", value); }
+ set => SetAttribute("href", value);
}
public int Priority
{
- get { return _priority; }
- set { _priority = value; }
+ get => _priority;
+ set => _priority = value;
}
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductPrices.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductPrices.cshtml
index f16e66e57..2327d1332 100644
--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductPrices.cshtml
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Product/Partials/CreateOrUpdate.ProductPrices.cshtml
@@ -5,7 +5,7 @@
var defaultCurrency = await currencyService.GetPrimaryStoreCurrency();
currencies = currencies.Where(x => x.Id != defaultCurrency.Id).ToList();
}
-@if (!string.IsNullOrEmpty(Model.Id) && currencies.Count > 0 && currencies.Count > 0)
+@if (!string.IsNullOrEmpty(Model.Id) && currencies.Count is > 0)
{
<div class="panel panel-default">
<div class="panel-body">
diff --git a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/HeadVendor.cshtml b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/HeadVendor.cshtml
index a69cc25d8..6f9f0a09d 100644
--- a/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/HeadVendor.cshtml
+++ b/src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/HeadVendor.cshtml
@@ -44,7 +44,7 @@
<script asp-location="Head" asp-src="@(Constants.WwwRoot)/administration/admin.common.js"></script>
<script asp-location="Head" asp-src="@string.Format(Constants.WwwRoot+"/administration/kendo/scripts/{0}/kendo.ui.core.min.js", kendoVersion)"></script>
<script asp-location="Head" asp-src="@string.Format(Constants.WwwRoot+"/administration/kendo/scripts/{0}/kendo.grid.js", kendoVersion)"></script>
- <script asp-location="Head" asp-src="@string.Format(Constants.WwwRoot+"/administration/kendo/scripts/{0}/cultures/kendo.culture.{1}.js", kendoVersion, @CultureInfo.CurrentCulture.Name)"></script>
+ <script asp-location="Head" asp-src="@string.Format(Constants.WwwRoot+"/administration/kendo/scripts/{0}/cultures/kendo.culture.{1}.js", kendoVersion, CultureInfo.CurrentCulture.Name)"></script>
<script asp-location="Footer" asp-src="@(Constants.WwwRoot)/administration/bootstrap/js/popper.min.js"></script>
diff --git a/src/Web/Grand.Web.Vendor/Endpoints/EndpointProvider.cs b/src/Web/Grand.Web.Vendor/Endpoints/EndpointProvider.cs
index 7b14fb7dc..8d8572c31 100644
--- a/src/Web/Grand.Web.Vendor/Endpoints/EndpointProvider.cs
+++ b/src/Web/Grand.Web.Vendor/Endpoints/EndpointProvider.cs
@@ -16,10 +16,10 @@ namespace Grand.Web.Vendor.Endpoints
pattern: $"{Constants.AreaVendor}/{{controller=Home}}/{{action=Index}}/{{id?}}");
//vendor index
- endpointRouteBuilder.MapControllerRoute("VendorIndex", $"vendor/", new { controller = "Home", action = "Index", area = Constants.AreaVendor });
+ endpointRouteBuilder.MapControllerRoute("VendorIndex", "vendor/", new { controller = "Home", action = "Index", area = Constants.AreaVendor });
//vendor login
- endpointRouteBuilder.MapControllerRoute("VendorLogin", $"vendor/login/", new { controller = "Login", action = "Index", area = Constants.AreaVendor });
+ endpointRouteBuilder.MapControllerRoute("VendorLogin", "vendor/login/", new { controller = "Login", action = "Index", area = Constants.AreaVendor });
}
public int Priority => 10;
diff --git a/src/Web/Grand.Web/Controllers/CommonController.cs b/src/Web/Grand.Web/Controllers/CommonController.cs
index 5969b5197..e0d08e166 100644
--- a/src/Web/Grand.Web/Controllers/CommonController.cs
+++ b/src/Web/Grand.Web/Controllers/CommonController.cs
@@ -54,7 +54,7 @@ namespace Grand.Web.Controllers
if (string.IsNullOrEmpty(url))
return url;
- var _ = new PathString(url).StartsWithSegments(pathBase, out PathString resultpath);
+ _ = new PathString(url).StartsWithSegments(pathBase, out PathString resultpath);
url = WebUtility.UrlDecode(resultpath);
url = url.TrimStart('/');
@@ -66,7 +66,7 @@ namespace Grand.Web.Controllers
private async Task<bool> IsLocalized(string url, PathString pathBase)
{
- var _ = new PathString(url).StartsWithSegments(pathBase, out PathString result);
+ _ = new PathString(url).StartsWithSegments(pathBase, out PathString result);
url = WebUtility.UrlDecode(result);
var firstSegment = url.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault() ??
diff --git a/src/Web/Grand.Web/Controllers/DownloadController.cs b/src/Web/Grand.Web/Controllers/DownloadController.cs
index 37350a38b..5c2b62894 100644
--- a/src/Web/Grand.Web/Controllers/DownloadController.cs
+++ b/src/Web/Grand.Web/Controllers/DownloadController.cs
@@ -142,8 +142,8 @@ namespace Grand.Web.Controllers
}
else
{
- await System.IO.File.WriteAllBytesAsync(@"App_Data/Download/" + fileName, download.DownloadBinary);
- ziparchive.CreateEntryFromFile(@"App_Data/Download/" + fileName, fileName);
+ await System.IO.File.WriteAllBytesAsync("App_Data/Download/" + fileName, download.DownloadBinary);
+ ziparchive.CreateEntryFromFile("App_Data/Download/" + fileName, fileName);
}
foreach (var bundle in product.BundleProducts)
{
@@ -160,8 +160,8 @@ namespace Grand.Web.Controllers
}
else
{
- await System.IO.File.WriteAllBytesAsync(@"App_Data/Download/" + fileName, d1.DownloadBinary);
- ziparchive.CreateEntryFromFile(@"App_Data/Download/" + fileName, fileName);
+ await System.IO.File.WriteAllBytesAsync("App_Data/Download/" + fileName, d1.DownloadBinary);
+ ziparchive.CreateEntryFromFile("App_Data/Download/" + fileName, fileName);
}
}
}
diff --git a/src/Web/Grand.Web/Controllers/ShoppingCartController.cs b/src/Web/Grand.Web/Controllers/ShoppingCartController.cs
index a1456d531..5104b11e0 100644
--- a/src/Web/Grand.Web/Controllers/ShoppingCartController.cs
+++ b/src/Web/Grand.Web/Controllers/ShoppingCartController.cs
@@ -504,7 +504,7 @@ namespace Grand.Web.Controllers
ShoppingCartType.ShoppingCart, ShoppingCartType.Auctions);
List<CustomAttribute> checkoutAttributes;
//parse and save checkout attributes
- if (model?.Attributes != null && model.Attributes.Count > 0)
+ if (model?.Attributes is { Count: > 0 })
{
checkoutAttributes = (await _mediator.Send(new SaveCheckoutAttributesCommand {
Customer = _workContext.CurrentCustomer,
diff --git a/src/Web/Grand.Web/Features/Handlers/Customers/GetNavigationHandler.cs b/src/Web/Grand.Web/Features/Handlers/Customers/GetNavigationHandler.cs
index 4f246c52c..dd7a2992b 100644
--- a/src/Web/Grand.Web/Features/Handlers/Customers/GetNavigationHandler.cs
+++ b/src/Web/Grand.Web/Features/Handlers/Customers/GetNavigationHandler.cs
@@ -40,9 +40,9 @@ namespace Grand.Web.Features.Handlers.Customers
HideDocuments = _customerSettings.HideDocumentsTab,
HideReviews = _customerSettings.HideReviewsTab,
HideCourses = _customerSettings.HideCoursesTab,
- HideSubAccounts = _customerSettings.HideSubAccountsTab || !string.IsNullOrEmpty(request.Customer.OwnerId)
+ HideSubAccounts = _customerSettings.HideSubAccountsTab || !string.IsNullOrEmpty(request.Customer.OwnerId),
+ SelectedTab = (AccountNavigationEnum)request.SelectedTabId
};
- model.SelectedTab = (AccountNavigationEnum)request.SelectedTabId;
return await Task.FromResult(model);
}