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.

Admin panel - code improvements (#404)

Krzysztof Pajak6af577ff3cc9
diff --git a/src/Business/Grand.Business.System/Services/Installation/InstallDataSettings.cs b/src/Business/Grand.Business.System/Services/Installation/InstallDataSettings.cs
index 7fcb99cb0..80a367a8b 100644
--- a/src/Business/Grand.Business.System/Services/Installation/InstallDataSettings.cs
+++ b/src/Business/Grand.Business.System/Services/Installation/InstallDataSettings.cs
@@ -559,12 +559,6 @@ namespace Grand.Business.System.Services.Installation
await _settingService.SaveSetting(new WidgetSettings {
ActiveWidgetSystemNames = new List<string> { "Widgets.Slider" },
});
-
- await _settingService.SaveSetting(new GoogleAnalyticsSettings() {
- gaprivateKey = "",
- gaserviceAccountEmail = "",
- gaviewID = ""
- });
}
}
}
diff --git a/src/Core/Grand.Domain/Seo/GoogleAnalyticsSettings.cs b/src/Core/Grand.Domain/Seo/GoogleAnalyticsSettings.cs
deleted file mode 100644
index 2ffd5e4b2..000000000
--- a/src/Core/Grand.Domain/Seo/GoogleAnalyticsSettings.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using Grand.Domain.Configuration;
-
-namespace Grand.Domain.Seo
-{
- /// <summary>
- /// GoogleAnalytics settings
- /// </summary>
- public class GoogleAnalyticsSettings : ISettings
- {
- /// <summary>
- /// GoogleAnalytics PrivateKey
- /// </summary>
- public string gaprivateKey { get; set; }
-
- /// <summary>
- /// GoogleAnalytics ServiceAccountEmail
- /// </summary>
- public string gaserviceAccountEmail { get; set; }
-
- /// <summary>
- /// GoogleAnalytics ViewID
- /// </summary>
- public string gaviewID { get; set; }
-
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/ActivityLog/ListTypes.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/ActivityLog/ListTypes.cshtml
index bffdd96fb..311e7182b 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/ActivityLog/ListTypes.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/ActivityLog/ListTypes.cshtml
@@ -37,7 +37,7 @@
//local datasource
var activityLogTypes = [
- @for(int i=0;i<Model.Count;i++)
+ @for(var i=0;i<Model.Count;i++)
{
var alt = Model[i];
<text>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/AddressAttribute/Partials/CreateOrUpdate.TabValues.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/AddressAttribute/Partials/CreateOrUpdate.TabValues.cshtml
index 4f051db0d..2b5206a8d 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/AddressAttribute/Partials/CreateOrUpdate.TabValues.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/AddressAttribute/Partials/CreateOrUpdate.TabValues.cshtml
@@ -1,6 +1,6 @@
@model AddressAttributeModel
@{
- if (!String.IsNullOrEmpty(Model.Id))
+ if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<div class="panel-body">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Affiliate/Partials/CreateOrUpdate.TabInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Affiliate/Partials/CreateOrUpdate.TabInfo.cshtml
index cea5691ba..9da7bb4d6 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Affiliate/Partials/CreateOrUpdate.TabInfo.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Affiliate/Partials/CreateOrUpdate.TabInfo.cshtml
@@ -4,7 +4,7 @@
<vc:admin-widget widget-zone="affiliate_details_info_top" additional-data="Model" />
<div class="form-body">
- @if (!String.IsNullOrEmpty(Model.Id))
+ @if (!string.IsNullOrEmpty(Model.Id))
{
<div class="form-group">
<admin-label asp-for="Id" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Affiliate/Partials/CreateOrUpdate.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Affiliate/Partials/CreateOrUpdate.cshtml
index 48ae7b166..f8cc846ce 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Affiliate/Partials/CreateOrUpdate.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Affiliate/Partials/CreateOrUpdate.cshtml
@@ -11,7 +11,7 @@
</div>
</content>
</tabstrip-item>
- @if (!String.IsNullOrEmpty(Model.Id))
+ @if (!string.IsNullOrEmpty(Model.Id))
{
<tabstrip-item text="@Loc["Admin.Affiliates.Customers"]" tab-index="1">
<content>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Comments.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Comments.cshtml
index f97d0a530..51ea4089a 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Comments.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Comments.cshtml
@@ -28,10 +28,10 @@
</div>
@{
- string readUrl = "";
+ var readUrl = "";
if (!string.IsNullOrEmpty(filterByBlogPostId))
{
- readUrl = Url.Action("Comments", "Blog", new { filterByBlogPostId = filterByBlogPostId, area = Constants.AreaAdmin });
+ readUrl = Url.Action("Comments", "Blog", new { filterByBlogPostId, area = Constants.AreaAdmin });
}
else
{
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Edit.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Edit.cshtml
index b42859071..03d208015 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Edit.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Edit.cshtml
@@ -17,7 +17,7 @@
</div>
<div class="actions">
<div class="btn-group btn-group-devided">
- <button type="button" onclick="window.open('@Url.RouteUrl("BlogPost", new {SeName = Model.SeName})','_blank');" class="btn purple">
+ <button type="button" onclick="window.open('@Url.RouteUrl("BlogPost", new { Model.SeName})','_blank');" class="btn purple">
<i class="fa fa-eye"></i>
@Loc["Admin.Common.Preview"]
</button>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Partials/CreateOrUpdate.TabComments.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Partials/CreateOrUpdate.TabComments.cshtml
index 98cfb9fec..1ada90da1 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Partials/CreateOrUpdate.TabComments.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Partials/CreateOrUpdate.TabComments.cshtml
@@ -1,6 +1,6 @@
@model BlogPostModel
@inject AdminAreaSettings adminAreaSettings
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<vc:admin-widget widget-zone="blog_details_comments_top" additional-data="Model" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Partials/CreateOrUpdate.TabInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Partials/CreateOrUpdate.TabInfo.cshtml
index e53d71b30..4405c4128 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Partials/CreateOrUpdate.TabInfo.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Partials/CreateOrUpdate.TabInfo.cshtml
@@ -7,7 +7,7 @@
var blogTags = await blogService.GetAllBlogPostTags("", true);
var blogTagsSb = new StringBuilder();
blogTagsSb.Append("var initialBlogTags = [");
- for (int i = 0; i < blogTags.Count; i++)
+ for (var i = 0; i < blogTags.Count; i++)
{
var tag = blogTags[i];
blogTagsSb.Append("'");
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Partials/CreateOrUpdate.TabProducts.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Partials/CreateOrUpdate.TabProducts.cshtml
index d5f0e67eb..f9f617116 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Partials/CreateOrUpdate.TabProducts.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Partials/CreateOrUpdate.TabProducts.cshtml
@@ -1,6 +1,6 @@
@model BlogPostModel
@inject AdminAreaSettings adminAreaSettings
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<vc:admin-widget widget-zone="blog_details_product_top" additional-data="Model" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Partials/CreateOrUpdateCategory.Posts.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Partials/CreateOrUpdateCategory.Posts.cshtml
index 1d5422248..4c0bdf554 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Partials/CreateOrUpdateCategory.Posts.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Blog/Partials/CreateOrUpdateCategory.Posts.cshtml
@@ -1,7 +1,7 @@
@model BlogCategoryModel
@inject AdminAreaSettings adminAreaSettings
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<div class="panel-body">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Brand/Edit.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Brand/Edit.cshtml
index f27ba342a..594f3c66a 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Brand/Edit.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Brand/Edit.cshtml
@@ -16,7 +16,7 @@
</div>
<div class="actions">
<div class="btn-group btn-group-devided util-btn-margin-bottom-5">
- <button type="button" onclick="window.open('@Url.RouteUrl("Brand", new {SeName = Model.SeName})','_blank');" class="btn purple">
+ <button type="button" onclick="window.open('@Url.RouteUrl("Brand", new { Model.SeName})','_blank');" class="btn purple">
<i class="fa fa-eye"></i>
@Loc["Admin.Common.Preview"]
</button>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Brand/Partials/CreateOrUpdate.TabActivityLog.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Brand/Partials/CreateOrUpdate.TabActivityLog.cshtml
index 57881cb7b..8c1ef91a8 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Brand/Partials/CreateOrUpdate.TabActivityLog.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Brand/Partials/CreateOrUpdate.TabActivityLog.cshtml
@@ -1,6 +1,6 @@
@model BrandModel
@inject AdminAreaSettings adminAreaSettings
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<vc:admin-widget widget-zone="brand_activity_log_top" additional-data="Model" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Brand/Partials/CreateOrUpdate.TabDiscounts.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Brand/Partials/CreateOrUpdate.TabDiscounts.cshtml
index 94b671e90..dc0a51cbd 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Brand/Partials/CreateOrUpdate.TabDiscounts.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Brand/Partials/CreateOrUpdate.TabDiscounts.cshtml
@@ -1,7 +1,7 @@
@model BrandModel
<vc:admin-widget widget-zone="brand_discounts_top" additional-data="Model" />
@{
- if (Model.AvailableDiscounts != null && Model.AvailableDiscounts.Count > 0)
+ if (Model.AvailableDiscounts is {Count: > 0 })
{
<div class="mt-checkbox-list">
@foreach (var discount in Model.AvailableDiscounts)
@@ -17,7 +17,7 @@
else
{
<div class="note note-info">
- @Html.Raw(@Loc["Admin.Catalog.Brands.Discounts.NoDiscounts"])
+ @Html.Raw(Loc["Admin.Catalog.Brands.Discounts.NoDiscounts"])
</div>
}
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Brand/Partials/CreateOrUpdate.TabDocuments.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Brand/Partials/CreateOrUpdate.TabDocuments.cshtml
index c4e7f2c16..45b24a736 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Brand/Partials/CreateOrUpdate.TabDocuments.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Brand/Partials/CreateOrUpdate.TabDocuments.cshtml
@@ -1,6 +1,6 @@
@model BrandModel
@inject AdminAreaSettings adminAreaSettings
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Campaign/Partials/CreateOrUpdate.TabEmails.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Campaign/Partials/CreateOrUpdate.TabEmails.cshtml
index 3fa59a05b..500d22713 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Campaign/Partials/CreateOrUpdate.TabEmails.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Campaign/Partials/CreateOrUpdate.TabEmails.cshtml
@@ -1,7 +1,7 @@
@model CampaignModel
@inject AdminAreaSettings adminAreaSettings
@{
- if (!String.IsNullOrEmpty(Model.Id))
+ if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<div class="panel-body">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Campaign/Partials/CreateOrUpdate.TabHistory.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Campaign/Partials/CreateOrUpdate.TabHistory.cshtml
index c745b9a8d..ef56ecb28 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Campaign/Partials/CreateOrUpdate.TabHistory.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Campaign/Partials/CreateOrUpdate.TabHistory.cshtml
@@ -1,7 +1,7 @@
@model CampaignModel
@inject AdminAreaSettings adminAreaSettings
@{
- if (!String.IsNullOrEmpty(Model.Id))
+ if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<div class="panel-body">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Campaign/Partials/CreateOrUpdate.TabTest.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Campaign/Partials/CreateOrUpdate.TabTest.cshtml
index 3cd773724..361d9de12 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Campaign/Partials/CreateOrUpdate.TabTest.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Campaign/Partials/CreateOrUpdate.TabTest.cshtml
@@ -1,6 +1,6 @@
@model CampaignModel
@{
- if (!String.IsNullOrEmpty(Model.Id))
+ if (!string.IsNullOrEmpty(Model.Id))
{
<div class="form-horizontal">
<div class="form-body">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Category/Edit.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Category/Edit.cshtml
index 9f5a103b1..d24fb5977 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Category/Edit.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Category/Edit.cshtml
@@ -16,7 +16,7 @@
</div>
<div class="actions">
<div class="btn-group btn-group-devided util-btn-margin-bottom-5">
- <button type="button" onclick="window.open('@Url.RouteUrl("Category", new {SeName = Model.SeName})','_blank');" class="btn purple">
+ <button type="button" onclick="window.open('@Url.RouteUrl("Category", new { Model.SeName})','_blank');" class="btn purple">
<i class="fa fa-eye"></i>
@Loc["Admin.Common.Preview"]
</button>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Category/Partials/CreateOrUpdate.TabActivityLog.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Category/Partials/CreateOrUpdate.TabActivityLog.cshtml
index 0520d094c..6b4d6e242 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Category/Partials/CreateOrUpdate.TabActivityLog.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Category/Partials/CreateOrUpdate.TabActivityLog.cshtml
@@ -1,6 +1,6 @@
@model CategoryModel
@inject AdminAreaSettings adminAreaSettings
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<vc:admin-widget widget-zone="category_details_activity_top" additional-data="Model" />
<div class="panel panel-default">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Category/Partials/CreateOrUpdate.TabDiscounts.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Category/Partials/CreateOrUpdate.TabDiscounts.cshtml
index 0241c4381..4363a2477 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Category/Partials/CreateOrUpdate.TabDiscounts.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Category/Partials/CreateOrUpdate.TabDiscounts.cshtml
@@ -1,6 +1,6 @@
@model CategoryModel
<vc:admin-widget widget-zone="category_details_discounts_top" additional-data="Model" />
-@if (Model.AvailableDiscounts != null && Model.AvailableDiscounts.Count > 0)
+@if (Model.AvailableDiscounts is {Count: > 0 })
{
<div class="mt-checkbox-list">
@foreach (var discount in Model.AvailableDiscounts)
@@ -16,7 +16,7 @@
else
{
<div class="note note-info">
- @Html.Raw(@Loc["Admin.Catalog.Categories.Discounts.NoDiscounts"])
+ @Html.Raw(Loc["Admin.Catalog.Categories.Discounts.NoDiscounts"])
</div>
}
<vc:admin-widget widget-zone="category_details_discounts_bottom" additional-data="Model" />
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Category/Partials/CreateOrUpdate.TabDocuments.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Category/Partials/CreateOrUpdate.TabDocuments.cshtml
index 1128667d6..ed6d1cf64 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Category/Partials/CreateOrUpdate.TabDocuments.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Category/Partials/CreateOrUpdate.TabDocuments.cshtml
@@ -1,6 +1,6 @@
@model CategoryModel
@inject AdminAreaSettings adminAreaSettings
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Category/Partials/CreateOrUpdate.TabProducts.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Category/Partials/CreateOrUpdate.TabProducts.cshtml
index f52d17ebc..d530c11e3 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Category/Partials/CreateOrUpdate.TabProducts.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Category/Partials/CreateOrUpdate.TabProducts.cshtml
@@ -1,7 +1,7 @@
@model CategoryModel
@inject AdminAreaSettings adminAreaSettings
<vc:admin-widget widget-zone="category_details_products_top" additional-data="Model" />
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<div class="panel-body">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CheckoutAttribute/Partials/CreateOrUpdate.TabCondition.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CheckoutAttribute/Partials/CreateOrUpdate.TabCondition.cshtml
index d75c117c3..9a3559eeb 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CheckoutAttribute/Partials/CreateOrUpdate.TabCondition.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CheckoutAttribute/Partials/CreateOrUpdate.TabCondition.cshtml
@@ -1,7 +1,7 @@
@model CheckoutAttributeModel
<vc:admin-widget widget-zone="checkout_attribute_details_condition_top" additional-data="Model" />
@{
- if (!String.IsNullOrEmpty(Model.Id))
+ if (!string.IsNullOrEmpty(Model.Id))
{
<script>
$(document).ready(function () {
@@ -40,7 +40,7 @@
<div class="form-group">
<admin-label asp-for="ConditionModel.SelectedAttributeId" />
<div class="col-md-9 col-sm-9">
- <admin-select asp-for="ConditionModel.SelectedAttributeId" asp-items="Model.ConditionModel.ConditionAttributes.Select(x => new SelectListItem() { Text = x.Name, Value = x.Id.ToString() })" />
+ <admin-select asp-for="ConditionModel.SelectedAttributeId" asp-items="Model.ConditionModel.ConditionAttributes.Select(x => new SelectListItem { Text = x.Name, Value = x.Id.ToString() })" />
<script>
$(document).ready(function() {
$("#@Html.IdFor(model => model.ConditionModel.SelectedAttributeId)").change(toggleConditionAttributes);
@@ -57,10 +57,10 @@
<div class="form-group">
<label class="control-label col-md-3"></label>
<div class="col-md-9 col-sm-9">
- @for (int i = 0; i < Model.ConditionModel.ConditionAttributes.Count; i++)
+ @for (var i = 0; i < Model.ConditionModel.ConditionAttributes.Count; i++)
{
<input type="hidden" asp-for="@Model.ConditionModel.ConditionAttributes[i].Id" />
- <div id="@string.Format("pnl_attribute_values_{0}", Model.ConditionModel.ConditionAttributes[i].Id)">
+ <div id="@($"pnl_attribute_values_{Model.ConditionModel.ConditionAttributes[i].Id}")">
@switch (Model.ConditionModel.ConditionAttributes[i].AttributeControlType)
{
case AttributeControlType.DropdownList:
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CheckoutAttribute/Partials/CreateOrUpdate.TabValues.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CheckoutAttribute/Partials/CreateOrUpdate.TabValues.cshtml
index dec71ef1e..d593c0b59 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CheckoutAttribute/Partials/CreateOrUpdate.TabValues.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CheckoutAttribute/Partials/CreateOrUpdate.TabValues.cshtml
@@ -2,7 +2,7 @@
<vc:admin-widget widget-zone="checkout_attribute_details_values_top" additional-data="Model" />
@{
- if (!String.IsNullOrEmpty(Model.Id))
+ if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<div class="panel-body">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Collection/Edit.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Collection/Edit.cshtml
index cf1d3fe70..13c3baea0 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Collection/Edit.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Collection/Edit.cshtml
@@ -16,7 +16,7 @@
</div>
<div class="actions">
<div class="btn-group btn-group-devided util-btn-margin-bottom-5">
- <button type="button" onclick="window.open('@Url.RouteUrl("Collection", new {SeName = Model.SeName})','_blank');" class="btn purple">
+ <button type="button" onclick="window.open('@Url.RouteUrl("Collection", new { Model.SeName})','_blank');" class="btn purple">
<i class="fa fa-eye"></i>
@Loc["Admin.Common.Preview"]
</button>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Collection/Partials/CreateOrUpdate.TabActivityLog.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Collection/Partials/CreateOrUpdate.TabActivityLog.cshtml
index 72445a2bf..e1466be76 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Collection/Partials/CreateOrUpdate.TabActivityLog.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Collection/Partials/CreateOrUpdate.TabActivityLog.cshtml
@@ -1,6 +1,6 @@
@model CollectionModel
@inject AdminAreaSettings adminAreaSettings
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<vc:admin-widget widget-zone="collection_activity_log_top" additional-data="Model" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Collection/Partials/CreateOrUpdate.TabDiscounts.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Collection/Partials/CreateOrUpdate.TabDiscounts.cshtml
index 4320299fb..fdeb263ce 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Collection/Partials/CreateOrUpdate.TabDiscounts.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Collection/Partials/CreateOrUpdate.TabDiscounts.cshtml
@@ -1,7 +1,7 @@
@model CollectionModel
<vc:admin-widget widget-zone="collection_discounts_top" additional-data="Model" />
@{
- if (Model.AvailableDiscounts != null && Model.AvailableDiscounts.Count > 0)
+ if (Model.AvailableDiscounts is {Count: > 0 })
{
<div class="mt-checkbox-list">
@foreach (var discount in Model.AvailableDiscounts)
@@ -17,7 +17,7 @@
else
{
<div class="note note-info">
- @Html.Raw(@Loc["Admin.Catalog.Collections.Discounts.NoDiscounts"])
+ @Html.Raw(Loc["Admin.Catalog.Collections.Discounts.NoDiscounts"])
</div>
}
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Collection/Partials/CreateOrUpdate.TabDocuments.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Collection/Partials/CreateOrUpdate.TabDocuments.cshtml
index 3939a19ff..6fff55bb2 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Collection/Partials/CreateOrUpdate.TabDocuments.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Collection/Partials/CreateOrUpdate.TabDocuments.cshtml
@@ -1,6 +1,6 @@
@model CollectionModel
@inject AdminAreaSettings adminAreaSettings
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Collection/Partials/CreateOrUpdate.TabProducts.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Collection/Partials/CreateOrUpdate.TabProducts.cshtml
index 1056587e7..c49023fe4 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Collection/Partials/CreateOrUpdate.TabProducts.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Collection/Partials/CreateOrUpdate.TabProducts.cshtml
@@ -1,6 +1,6 @@
@model CollectionModel
@inject AdminAreaSettings adminAreaSettings
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<vc:admin-widget widget-zone="collection_details_products_top" additional-data="Model" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/ContactAttribute/Partials/CreateOrUpdate.TabCondition.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/ContactAttribute/Partials/CreateOrUpdate.TabCondition.cshtml
index 2cc672763..ca5dfaabe 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/ContactAttribute/Partials/CreateOrUpdate.TabCondition.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/ContactAttribute/Partials/CreateOrUpdate.TabCondition.cshtml
@@ -1,7 +1,7 @@
@model ContactAttributeModel
<vc:admin-widget widget-zone="contact_attribute_details_condition_top" additional-data="Model" />
@{
- if (!String.IsNullOrEmpty(Model.Id))
+ if (!string.IsNullOrEmpty(Model.Id))
{
<script>
$(document).ready(function () {
@@ -40,7 +40,7 @@
<div class="form-group">
<admin-label asp-for="ConditionModel.SelectedAttributeId" />
<div class="col-md-9 col-sm-9">
- <admin-select asp-for="ConditionModel.SelectedAttributeId" asp-items="Model.ConditionModel.ConditionAttributes.Select(x => new SelectListItem() { Text = x.Name, Value = x.Id.ToString() })" />
+ <admin-select asp-for="ConditionModel.SelectedAttributeId" asp-items="Model.ConditionModel.ConditionAttributes.Select(x => new SelectListItem { Text = x.Name, Value = x.Id.ToString() })" />
<script>
$(document).ready(function() {
$("#@Html.IdFor(model => model.ConditionModel.SelectedAttributeId)").change(toggleConditionAttributes);
@@ -57,10 +57,10 @@
<div class="form-group">
<label class="control-label col-md-3"></label>
<div class="col-md-9 col-sm-9">
- @for (int i = 0; i < Model.ConditionModel.ConditionAttributes.Count; i++)
+ @for (var i = 0; i < Model.ConditionModel.ConditionAttributes.Count; i++)
{
<input type="hidden" asp-for="@Model.ConditionModel.ConditionAttributes[i].Id" />
- <div id="@string.Format("pnl_attribute_values_{0}", Model.ConditionModel.ConditionAttributes[i].Id)">
+ <div id="@($"pnl_attribute_values_{Model.ConditionModel.ConditionAttributes[i].Id}")">
@switch (Model.ConditionModel.ConditionAttributes[i].AttributeControlType)
{
case AttributeControlType.DropdownList:
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/ContactAttribute/Partials/CreateOrUpdate.TabValues.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/ContactAttribute/Partials/CreateOrUpdate.TabValues.cshtml
index 8940a6719..d237b2142 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/ContactAttribute/Partials/CreateOrUpdate.TabValues.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/ContactAttribute/Partials/CreateOrUpdate.TabValues.cshtml
@@ -2,7 +2,7 @@
<vc:admin-widget widget-zone="contact_attribute_details_values_top" additional-data="Model" />
@{
- if (!String.IsNullOrEmpty(Model.Id))
+ if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<div class="panel-body">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Country/Partials/CreateOrUpdate.TabStates.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Country/Partials/CreateOrUpdate.TabStates.cshtml
index 0ad43ec90..c10c7165a 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Country/Partials/CreateOrUpdate.TabStates.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Country/Partials/CreateOrUpdate.TabStates.cshtml
@@ -1,7 +1,7 @@
@model CountryModel
<vc:admin-widget widget-zone="country_details_states_top" additional-data="Model" />
@{
- if (!String.IsNullOrEmpty(Model.Id))
+ if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<div class="panel-body">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Course/AssociateProductToCoursePopup.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Course/AssociateProductToCoursePopup.cshtml
index 32717bf36..d336c2348 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Course/AssociateProductToCoursePopup.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Course/AssociateProductToCoursePopup.cshtml
@@ -101,9 +101,6 @@
}
<input asp-for="AssociatedToProductId" type="hidden" />
-
- <div id="products-grid"></div>
-
<script>
var mfp = $.magnificPopup.instance;
$("#associateproduct").submit(function (e) {
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Course/Partials/CreateOrUpdate.Lesson.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Course/Partials/CreateOrUpdate.Lesson.cshtml
index 8c2fa2d80..214b05425 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Course/Partials/CreateOrUpdate.Lesson.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Course/Partials/CreateOrUpdate.Lesson.cshtml
@@ -1,6 +1,6 @@
@model CourseModel
<vc:admin-widget widget-zone="course_details_lesson_top" additional-data="Model" />
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<div class="panel-heading">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Course/Partials/CreateOrUpdate.Subject.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Course/Partials/CreateOrUpdate.Subject.cshtml
index 326aa55b0..f532fe62b 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Course/Partials/CreateOrUpdate.Subject.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Course/Partials/CreateOrUpdate.Subject.cshtml
@@ -1,6 +1,6 @@
@model CourseModel
<vc:admin-widget widget-zone="course_details_subject_top" additional-data="Model" />
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<div class="panel-body">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Course/Partials/CreateOrUpdate.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Course/Partials/CreateOrUpdate.cshtml
index 8a57f79cc..6c48ff3bb 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Course/Partials/CreateOrUpdate.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Course/Partials/CreateOrUpdate.cshtml
@@ -41,5 +41,4 @@
</tabstrip-item>
<vc:admin-widget widget-zone="course_details_tabs" additional-data="Model" />
</items>
-</admin-tabstrip>
-<input id="active-menu-item" type="hidden" value="/@Constants.AreaAdmin/Course/List" />
\ No newline at end of file
+</admin-tabstrip>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Currency/List.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Currency/List.cshtml
index dbacbeaab..bf38fd77c 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Currency/List.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Currency/List.cshtml
@@ -1,5 +1,5 @@
@{
- List<Grand.Domain.Directory.ExchangeRate> rates = ViewBag.Rates;
+ List<ExchangeRate> rates = ViewBag.Rates;
bool autoUpdateEnabled = ViewBag.AutoUpdateEnabled ?? false;
//page title
ViewBag.Title = Loc["Admin.Configuration.Currencies"];
@@ -185,7 +185,7 @@
<script>
//local datasource
var rates = [
- @for (int i = 0; i < rates.Count; i++)
+ @for (var i = 0; i < rates.Count; i++)
{
var rate = rates[i];
<text>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Currency/Partials/CreateOrUpdate.TabInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Currency/Partials/CreateOrUpdate.TabInfo.cshtml
index 2559eff05..5443deec8 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Currency/Partials/CreateOrUpdate.TabInfo.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Currency/Partials/CreateOrUpdate.TabInfo.cshtml
@@ -51,7 +51,7 @@
.Select(x => new SelectListItem
{
Value = x.IetfLanguageTag,
- Text = string.Format("{0}. {1}", x.EnglishName, x.IetfLanguageTag)
+ Text = $"{x.EnglishName}. {x.IetfLanguageTag}"
})
.ToList();
cultures.Insert(0, new SelectListItem
@@ -116,7 +116,7 @@
<span asp-validation-for="Stores"></span>
</div>
</div>
- @if (!String.IsNullOrEmpty(Model.Id))
+ @if (!string.IsNullOrEmpty(Model.Id))
{
<div class="form-group">
<admin-label asp-for="CreatedOn" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/List.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/List.cshtml
index 1c5bf7066..bee14c986 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/List.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/List.cshtml
@@ -440,11 +440,6 @@
}
</script>
</form>
-<form asp-area="@Constants.AreaAdmin" asp-controller="Customer" asp-action="ExportXmlSelected" method="post" id="export-xml-selected-form">
-
- <input type="hidden" id="selectedIds" name="selectedIds" value="" />
-</form>
-
<script>
$(document).ready(function () {
$('#exportxml-selected').click(function (e) {
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/Partials/CreateOrUpdate.TabInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/Partials/CreateOrUpdate.TabInfo.cshtml
index cee800e22..4756c1e03 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/Partials/CreateOrUpdate.TabInfo.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/Partials/CreateOrUpdate.TabInfo.cshtml
@@ -37,7 +37,7 @@
<div class="form-body">
@if (Model.UsernamesEnabled)
{
- if (String.IsNullOrEmpty(Model.Id) || Model.AllowUsersToChangeUsernames)
+ if (string.IsNullOrEmpty(Model.Id) || Model.AllowUsersToChangeUsernames)
{
<div class="form-group">
<admin-label asp-for="Username" />
@@ -93,7 +93,7 @@
<span asp-validation-for="CustomerTags"></span>
</div>
</div>
- @if (!String.IsNullOrEmpty(Model.Id) && Model.AssociatedExternalAuthRecords.Count > 0)
+ @if (!string.IsNullOrEmpty(Model.Id) && Model.AssociatedExternalAuthRecords.Count > 0)
{
<div class="form-group">
<admin-label asp-for="AssociatedExternalAuthRecords" />
@@ -103,7 +103,7 @@
//local datasource
var externalauthrecords = [
- @for (int i = 0; i < Model.AssociatedExternalAuthRecords.Count; i++)
+ @for (var i = 0; i < Model.AssociatedExternalAuthRecords.Count; i++)
{
var aear = Model.AssociatedExternalAuthRecords[i];
<text>
@@ -203,11 +203,11 @@
<admin-label asp-for="Gender" />
<div class="col-md-9 col-sm-9">
<div class="gender">
- @Html.RadioButton("Gender", "M", (Model.Gender == "M"), new { id = "Gender_Male" })
+ @Html.RadioButton("Gender", "M", Model.Gender == "M", new { id = "Gender_Male" })
<label class="forcheckbox" for="Gender_Male">@Loc["Admin.Customers.Customers.Fields.Gender.Male"]</label>
</div>
<div class="gender">
- @Html.RadioButton("Gender", "F", (Model.Gender == "F"), new { id = "Gender_Female" })
+ @Html.RadioButton("Gender", "F", Model.Gender == "F", new { id = "Gender_Female" })
<label class="forcheckbox" for="Gender_Female">@Loc["Admin.Customers.Customers.Fields.Gender.Female"]</label>
</div>
</div>
@@ -370,7 +370,7 @@
<span asp-validation-for="TwoFactorEnabled"></span>
</div>
</div>
- @if (!String.IsNullOrEmpty(Model.AffiliateId))
+ @if (!string.IsNullOrEmpty(Model.AffiliateId))
{
<div class="form-group">
<admin-label asp-for="AffiliateId" />
@@ -397,7 +397,7 @@
</div>
</div>
}
- @if (Model.AvailableNewsletterSubscriptionStores != null && Model.AvailableNewsletterSubscriptionStores.Count > 0)
+ @if (Model.AvailableNewsletterSubscriptionStores is {Count: > 0 })
{
<div class="form-group">
<admin-label asp-for="SelectedNewsletterSubscriptionStoreIds" />
@@ -432,7 +432,7 @@
<span asp-validation-for="Active"></span>
</div>
</div>
- @if (!String.IsNullOrEmpty(Model.Id))
+ @if (!string.IsNullOrEmpty(Model.Id))
{
<div class="form-group">
<admin-label asp-for="LastIpAddress" />
@@ -441,7 +441,7 @@
</div>
</div>
}
- @if (!String.IsNullOrEmpty(Model.Id) && !String.IsNullOrEmpty(Model.UrlReferrer))
+ @if (!string.IsNullOrEmpty(Model.Id) && !string.IsNullOrEmpty(Model.UrlReferrer))
{
<div class="form-group">
<admin-label asp-for="UrlReferrer" />
@@ -450,7 +450,7 @@
</div>
</div>
}
- @if (!String.IsNullOrEmpty(Model.Id))
+ @if (!string.IsNullOrEmpty(Model.Id))
{
<div class="form-group">
<admin-label asp-for="CreatedOn" />
@@ -459,7 +459,7 @@
</div>
</div>
}
- @if (!String.IsNullOrEmpty(Model.Id))
+ @if (!string.IsNullOrEmpty(Model.Id))
{
<div class="form-group">
<admin-label asp-for="LastActivityDate" />
@@ -468,7 +468,7 @@
</div>
</div>
}
- @if (!String.IsNullOrEmpty(Model.Id) && !String.IsNullOrEmpty(Model.LastVisitedPage))
+ @if (!string.IsNullOrEmpty(Model.Id) && !string.IsNullOrEmpty(Model.LastVisitedPage))
{
<div class="form-group">
<admin-label asp-for="LastVisitedPage" />
@@ -477,7 +477,7 @@
</div>
</div>
}
- @if (!String.IsNullOrEmpty(Model.Id) && !String.IsNullOrEmpty(Model.LastUrlReferrer))
+ @if (!string.IsNullOrEmpty(Model.Id) && !string.IsNullOrEmpty(Model.LastUrlReferrer))
{
<div class="form-group">
<admin-label asp-for="LastUrlReferrer" />
@@ -486,7 +486,7 @@
</div>
</div>
}
- @if (!String.IsNullOrEmpty(Model.Id) && Model.LastPurchaseDate.HasValue)
+ @if (!string.IsNullOrEmpty(Model.Id) && Model.LastPurchaseDate.HasValue)
{
<div class="form-group">
<admin-label asp-for="LastPurchaseDate" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/Partials/CreateOrUpdate.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/Partials/CreateOrUpdate.cshtml
index c04439be9..3c7deb839 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/Partials/CreateOrUpdate.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/Partials/CreateOrUpdate.cshtml
@@ -39,7 +39,7 @@
</div>
</content>
</tabstrip-item>
- @if (!String.IsNullOrEmpty(Model.Id))
+ @if (!string.IsNullOrEmpty(Model.Id))
{
<tabstrip-item text="@Loc["Admin.Customers.Customers.Orders"]" tab-index="1">
<content>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/Partials/CustomerAttributes.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/Partials/CustomerAttributes.cshtml
index 4774306f2..60124a495 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/Partials/CustomerAttributes.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Customer/Partials/CustomerAttributes.cshtml
@@ -1,8 +1,8 @@
@model IList<CustomerModel.CustomerAttributeModel>
@foreach (var attribute in Model)
{
- string controlId = string.Format("customer_attribute_{0}", attribute.Id);
- string textPrompt = attribute.Name;
+ var controlId = $"customer_attribute_{attribute.Id}";
+ var textPrompt = attribute.Name;
<div class="form-horizontal">
<div class="form-body">
<label class="control-label col-md-3">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAttribute/Partials/CreateOrUpdate.TabValues.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAttribute/Partials/CreateOrUpdate.TabValues.cshtml
index 8bfa20e0b..102e12ffe 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAttribute/Partials/CreateOrUpdate.TabValues.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerAttribute/Partials/CreateOrUpdate.TabValues.cshtml
@@ -2,7 +2,7 @@
<vc:admin-widget widget-zone="customer_attribute_details_values_top" additional-data="Model" />
@{
- if (!String.IsNullOrEmpty(Model.Id))
+ if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<div class="panel-body">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerGroup/Partials/CreateOrUpdate.TabAcl.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerGroup/Partials/CreateOrUpdate.TabAcl.cshtml
index 61361420c..7f6d23520 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerGroup/Partials/CreateOrUpdate.TabAcl.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerGroup/Partials/CreateOrUpdate.TabAcl.cshtml
@@ -1,12 +1,12 @@
@model CustomerGroupModel
-@if (String.IsNullOrEmpty(Model.Id))
+@if (string.IsNullOrEmpty(Model.Id))
{
<div class="note note-info">
@Loc["Admin.Customers.CustomerGroups.Acl.SaveBeforeEdit"]
</div>
}
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<div class="panel-body">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerGroup/Partials/CreateOrUpdate.TabProducts.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerGroup/Partials/CreateOrUpdate.TabProducts.cshtml
index 5811d94a5..9c588b919 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerGroup/Partials/CreateOrUpdate.TabProducts.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerGroup/Partials/CreateOrUpdate.TabProducts.cshtml
@@ -1,15 +1,15 @@
@model CustomerGroupModel
-@if (String.IsNullOrEmpty(Model.Id))
+@if (string.IsNullOrEmpty(Model.Id))
{
<div class="note note-info">
@Loc["Admin.Customers.CustomerGroups.Products.SaveBeforeEdit"]
</div>
}
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="note note-info">
- @Html.Raw(@Loc["Admin.Customers.CustomerGroups.Products.Info"])
+ @Html.Raw(Loc["Admin.Customers.CustomerGroups.Products.Info"])
</div>
<div class="panel panel-default">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerTag/Partials/CreateOrUpdate.TabCustomers.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerTag/Partials/CreateOrUpdate.TabCustomers.cshtml
index 85f51ec5f..231fbd526 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerTag/Partials/CreateOrUpdate.TabCustomers.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerTag/Partials/CreateOrUpdate.TabCustomers.cshtml
@@ -2,13 +2,13 @@
@inject AdminAreaSettings adminAreaSettings
@{
- if (String.IsNullOrEmpty(Model.Id))
+ if (string.IsNullOrEmpty(Model.Id))
{
<div class="note note-info">
@Loc["Admin.Customers.CustomerTags.Customers.SaveBeforeEdit"]
</div>
}
- if (!String.IsNullOrEmpty(Model.Id))
+ if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<div class="panel-body">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerTag/Partials/CreateOrUpdate.TabProducts.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerTag/Partials/CreateOrUpdate.TabProducts.cshtml
index 87cc40680..dcb0d686f 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerTag/Partials/CreateOrUpdate.TabProducts.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/CustomerTag/Partials/CreateOrUpdate.TabProducts.cshtml
@@ -1,15 +1,15 @@
@model CustomerTagModel
@{
- if (String.IsNullOrEmpty(Model.Id))
+ if (string.IsNullOrEmpty(Model.Id))
{
<div class="note note-info">
@Loc["Admin.Customers.CustomerTags.Products.SaveBeforeEdit"]
</div>
}
- if (!String.IsNullOrEmpty(Model.Id))
+ if (!string.IsNullOrEmpty(Model.Id))
{
<div class="note note-info">
- @Html.Raw(@Loc["Admin.Customers.CustomerTags.Products.Info"])
+ @Html.Raw(Loc["Admin.Customers.CustomerTags.Products.Info"])
</div>
<div class="panel panel-default">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabAppliedToBrands.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabAppliedToBrands.cshtml
index 74dc8a450..d40795a72 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabAppliedToBrands.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabAppliedToBrands.cshtml
@@ -1,6 +1,6 @@
@model DiscountModel
@{
- if (!String.IsNullOrEmpty(Model.Id))
+ if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<vc:admin-widget widget-zone="discount_details_applied_to_brands_top" additional-data="Model" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabAppliedToCategories.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabAppliedToCategories.cshtml
index 262d94791..5ded421aa 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabAppliedToCategories.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabAppliedToCategories.cshtml
@@ -1,6 +1,6 @@
@model DiscountModel
@{
- if (!String.IsNullOrEmpty(Model.Id))
+ if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabAppliedToCollections.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabAppliedToCollections.cshtml
index ec93b79af..ddcd03490 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabAppliedToCollections.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabAppliedToCollections.cshtml
@@ -1,6 +1,6 @@
@model DiscountModel
@{
- if (!String.IsNullOrEmpty(Model.Id))
+ if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabAppliedToProducts.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabAppliedToProducts.cshtml
index 41af28429..17b3ba457 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabAppliedToProducts.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabAppliedToProducts.cshtml
@@ -2,7 +2,7 @@
@inject AdminAreaSettings adminAreaSettings
@{
- if (!String.IsNullOrEmpty(Model.Id))
+ if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabAppliedToVendors.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabAppliedToVendors.cshtml
index 7d367f0fd..bf073e1d6 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabAppliedToVendors.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabAppliedToVendors.cshtml
@@ -1,6 +1,6 @@
@model DiscountModel
@{
- if (!String.IsNullOrEmpty(Model.Id))
+ if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<vc:admin-widget widget-zone="discount_details_applied_to_vendors_top" additional-data="Model" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabCouponCodes.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabCouponCodes.cshtml
index 425ce84c7..a8490d160 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabCouponCodes.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabCouponCodes.cshtml
@@ -1,7 +1,7 @@
@model DiscountModel
@inject AdminAreaSettings adminAreaSettings
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<vc:admin-widget widget-zone="discount_details_coupon_codes_top" additional-data="Model" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabInfo.cshtml
index 5b37d956a..282fd2be3 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabInfo.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabInfo.cshtml
@@ -1,6 +1,5 @@
@model DiscountModel
@using Grand.Domain.Discounts;
-@using Grand.Web.Common.Page;
<script>
$(document).ready(function () {
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabRequirements.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabRequirements.cshtml
index 1529f0789..0c64c599e 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabRequirements.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.TabRequirements.cshtml
@@ -2,7 +2,7 @@
@{
<vc:admin-widget widget-zone="discount_details_requirements_top" additional-data="Model" />
- if (!String.IsNullOrEmpty(Model.Id))
+ if (!string.IsNullOrEmpty(Model.Id))
{
<script>
@@ -98,7 +98,7 @@
//array of exisiting discount requirements
var discountRequirements = [
- @for (int i = 0; i < Model.DiscountRequirementMetaInfos.Count; i++)
+ @for (var i = 0; i < Model.DiscountRequirementMetaInfos.Count; i++)
{
var drmi = Model.DiscountRequirementMetaInfos[i];
<text>{ discountRequirementId: "@(drmi.DiscountRequirementId)", ruleName: "@(drmi.RuleName)", url: "@(Html.Raw(drmi.ConfigurationUrl))" } </text> if (i != Model.DiscountRequirementMetaInfos.Count - 1)
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.cshtml
index 8114ffe70..f3f24e783 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/Partials/CreateOrUpdate.cshtml
@@ -60,7 +60,7 @@
</div>
</content>
</tabstrip-item>
- @if (!String.IsNullOrEmpty(Model.Id))
+ @if (!string.IsNullOrEmpty(Model.Id))
{
<tabstrip-item text="@Loc["admin.marketing.Discounts.History"]" tab-index="8">
<content>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/ProductAddPopup.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/ProductAddPopup.cshtml
index 691a84742..78ec8b68f 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/ProductAddPopup.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Discount/ProductAddPopup.cshtml
@@ -95,7 +95,6 @@
</div>
</div>
- <div id="products-grid"></div>
<script>
var mfp = $.magnificPopup.instance;
$("#ProductAddPopup").submit(function (e) {
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/EmailAccount/Partials/CreateOrUpdate.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/EmailAccount/Partials/CreateOrUpdate.cshtml
index d2f655c84..3a89b6b83 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/EmailAccount/Partials/CreateOrUpdate.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/EmailAccount/Partials/CreateOrUpdate.cshtml
@@ -67,7 +67,7 @@
<admin-select asp-for="SecureSocketOptionsId" asp-items="((Grand.Business.Core.Enums.Messages.SecureSocketOptions)Model.SecureSocketOptionsId).ToSelectList(Context)" />
</div>
</div>
- @if (!String.IsNullOrEmpty(Model.Id))
+ @if (!string.IsNullOrEmpty(Model.Id))
{
<div class="form-group">
<div class="note note-info">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/ExternalAuthentication/Methods.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/ExternalAuthentication/Methods.cshtml
index d3c9c8257..76e7a5d2e 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/ExternalAuthentication/Methods.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/ExternalAuthentication/Methods.cshtml
@@ -8,7 +8,7 @@
<div class="col-md-12">
<div class="x_panel light form-fit">
<div class="x_title">
- <div class="caption level-caption"">
+ <div class="caption level-caption">
<i class="fa fa-facebook"></i>
@Loc["Admin.Plugins.ExternalAuthenticationMethods"]
</div>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/GiftVoucher/Partials/CreateOrUpdate.TabInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/GiftVoucher/Partials/CreateOrUpdate.TabInfo.cshtml
index 36d28325b..a4d722774 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/GiftVoucher/Partials/CreateOrUpdate.TabInfo.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/GiftVoucher/Partials/CreateOrUpdate.TabInfo.cshtml
@@ -29,7 +29,7 @@
<span asp-validation-for="GiftVoucherTypeId"></span>
</div>
</div>
- @if (!String.IsNullOrEmpty(Model.PurchasedWithOrderId))
+ @if (!string.IsNullOrEmpty(Model.PurchasedWithOrderId))
{
<div class="form-group">
<admin-label asp-for="PurchasedWithOrderId" />
@@ -42,14 +42,14 @@
<admin-label asp-for="Amount" />
<div class="col-md-9 col-sm-9">
<admin-input asp-for="Amount" />
- @if (!String.IsNullOrEmpty(Model.Id))
+ @if (!string.IsNullOrEmpty(Model.Id))
{
<text>[@Model.CurrencyCode]</text>
}
<span asp-validation-for="Amount"></span>
</div>
</div>
- @if (String.IsNullOrEmpty(Model.Id))
+ @if (string.IsNullOrEmpty(Model.Id))
{
<div class="form-group">
<admin-label asp-for="CurrencyCode" class="col-sm-3 control-label" />
@@ -59,7 +59,7 @@
</div>
</div>
}
- @if (!String.IsNullOrEmpty(Model.Id))
+ @if (!string.IsNullOrEmpty(Model.Id))
{
<div class="form-group">
<admin-label asp-for="RemainingAmountStr" />
@@ -164,7 +164,7 @@
<span asp-validation-for="ValidTo"></span>
</div>
</div>
- @if (!String.IsNullOrEmpty(Model.Id))
+ @if (!string.IsNullOrEmpty(Model.Id))
{
<div class="form-group" id="pnlNotifyRecipient">
<admin-label asp-for="IsRecipientNotified" />
@@ -174,7 +174,7 @@
</div>
</div>
}
- @if (!String.IsNullOrEmpty(Model.Id))
+ @if (!string.IsNullOrEmpty(Model.Id))
{
<div class="form-group">
<admin-label asp-for="CreatedOn" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/GiftVoucher/Partials/CreateOrUpdate.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/GiftVoucher/Partials/CreateOrUpdate.cshtml
index 386c2ec40..79a0f5264 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/GiftVoucher/Partials/CreateOrUpdate.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/GiftVoucher/Partials/CreateOrUpdate.cshtml
@@ -11,7 +11,7 @@
</div>
</content>
</tabstrip-item>
- @if (!String.IsNullOrEmpty(Model.Id))
+ @if (!string.IsNullOrEmpty(Model.Id))
{
<tabstrip-item text="@Loc["Admin.GiftVouchers.History"]" tab-index="1">
<content>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/GoogleAnalytics/DashboardDataByDevice.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/GoogleAnalytics/DashboardDataByDevice.cshtml
deleted file mode 100644
index 41329c6a0..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/GoogleAnalytics/DashboardDataByDevice.cshtml
+++ /dev/null
@@ -1,36 +0,0 @@
-@model Grand.Web.Admin.Models.Common.GoogleAnalyticsResultModel
-
-@if(!String.IsNullOrEmpty(Model.Message))
-{
- <div class="note note-info">
- @Model.Message
- </div>
-}
-@if (Model.Records.Count > 0)
-{
-
- <div class="table-scrollable">
- <table class="table table-hover">
- <thead>
- <tr>
- @foreach (var item in Model.Records.FirstOrDefault())
- {
- <th> @item.Key </th>
- }
- </tr>
- </thead>
- <tbody>
- @foreach (var item in Model.Records)
- {
- <tr>
- @foreach (var pos in item)
- {
- <td> @pos.Value </td>
- }
- </tr>
- }
- </tbody>
- </table>
- </div>
-
-}
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/GoogleAnalytics/DashboardDataByExit.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/GoogleAnalytics/DashboardDataByExit.cshtml
deleted file mode 100644
index 41329c6a0..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/GoogleAnalytics/DashboardDataByExit.cshtml
+++ /dev/null
@@ -1,36 +0,0 @@
-@model Grand.Web.Admin.Models.Common.GoogleAnalyticsResultModel
-
-@if(!String.IsNullOrEmpty(Model.Message))
-{
- <div class="note note-info">
- @Model.Message
- </div>
-}
-@if (Model.Records.Count > 0)
-{
-
- <div class="table-scrollable">
- <table class="table table-hover">
- <thead>
- <tr>
- @foreach (var item in Model.Records.FirstOrDefault())
- {
- <th> @item.Key </th>
- }
- </tr>
- </thead>
- <tbody>
- @foreach (var item in Model.Records)
- {
- <tr>
- @foreach (var pos in item)
- {
- <td> @pos.Value </td>
- }
- </tr>
- }
- </tbody>
- </table>
- </div>
-
-}
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/GoogleAnalytics/DashboardDataByLocalization.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/GoogleAnalytics/DashboardDataByLocalization.cshtml
deleted file mode 100644
index 41329c6a0..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/GoogleAnalytics/DashboardDataByLocalization.cshtml
+++ /dev/null
@@ -1,36 +0,0 @@
-@model Grand.Web.Admin.Models.Common.GoogleAnalyticsResultModel
-
-@if(!String.IsNullOrEmpty(Model.Message))
-{
- <div class="note note-info">
- @Model.Message
- </div>
-}
-@if (Model.Records.Count > 0)
-{
-
- <div class="table-scrollable">
- <table class="table table-hover">
- <thead>
- <tr>
- @foreach (var item in Model.Records.FirstOrDefault())
- {
- <th> @item.Key </th>
- }
- </tr>
- </thead>
- <tbody>
- @foreach (var item in Model.Records)
- {
- <tr>
- @foreach (var pos in item)
- {
- <td> @pos.Value </td>
- }
- </tr>
- }
- </tbody>
- </table>
- </div>
-
-}
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/GoogleAnalytics/DashboardDataBySource.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/GoogleAnalytics/DashboardDataBySource.cshtml
deleted file mode 100644
index 41329c6a0..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/GoogleAnalytics/DashboardDataBySource.cshtml
+++ /dev/null
@@ -1,36 +0,0 @@
-@model Grand.Web.Admin.Models.Common.GoogleAnalyticsResultModel
-
-@if(!String.IsNullOrEmpty(Model.Message))
-{
- <div class="note note-info">
- @Model.Message
- </div>
-}
-@if (Model.Records.Count > 0)
-{
-
- <div class="table-scrollable">
- <table class="table table-hover">
- <thead>
- <tr>
- @foreach (var item in Model.Records.FirstOrDefault())
- {
- <th> @item.Key </th>
- }
- </tr>
- </thead>
- <tbody>
- @foreach (var item in Model.Records)
- {
- <tr>
- @foreach (var pos in item)
- {
- <td> @pos.Value </td>
- }
- </tr>
- }
- </tbody>
- </table>
- </div>
-
-}
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/GoogleAnalytics/DashboardGeneralData.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/GoogleAnalytics/DashboardGeneralData.cshtml
deleted file mode 100644
index 3a716ee10..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/GoogleAnalytics/DashboardGeneralData.cshtml
+++ /dev/null
@@ -1,53 +0,0 @@
-@model Grand.Web.Admin.Models.Common.GoogleAnalyticsResultModel
-
-@if(!String.IsNullOrEmpty(Model.Message))
-{
- <div class="note note-info">
- @Model.Message
- </div>
-}
-@if (Model.Records.Count > 0)
-{
-<div class="mt-element-list">
- <div class="mt-list-container list-simple ext-1 group" >
-
- @foreach (var item in Model.Records)
- {
- var usertype = item.Where(x => x.Key == "ga:userType").FirstOrDefault().Value;
- usertype = usertype.Replace(" ", "");
-
- <a class="list-toggle-container" data-toggle="collapse" href="#@(usertype)" aria-expanded="true">
- <div class="list-toggle uppercase" >
- @item.Where(x => x.Key == "ga:userType").FirstOrDefault().Value
- </div>
- </a>
- <div class="panel-collapse collapse in" id="@(usertype)" aria-expanded="true">
- <ul class="googleStatistics">
- @foreach (var pos in item.Where(x => x.Key != "ga:userType"))
- {
- if (pos.Value != "0")
- {
- <li class="mt-list-item">
- <div class="list-icon-container done">
- <a href="javascript:;">
- <i class="icon-check"></i>
- </a>
- </div>
- <div class="list-datetime">
- @pos.Value
- </div>
- <div class="list-item-content" style="padding: 0 15px 0 30px;">
- <h3 class="uppercase">
- @pos.Key
- </h3>
- </div>
- </li>
- }
-
- }
- </ul>
- </div>
- }
- </div>
-</div>
-}
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Home/Index.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Home/Index.cshtml
index f56d77187..be22d70ce 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Home/Index.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Home/Index.cshtml
@@ -5,7 +5,7 @@
@inject Grand.Business.Core.Interfaces.Customers.ICustomerService customerService
@inject Grand.Business.Core.Interfaces.System.Reports.IOrderReportService orderReportService
@inject Grand.Business.Core.Interfaces.Catalog.Prices.IPriceFormatter priceFormatter
-@inject Grand.Infrastructure.IWorkContext workContext
+@inject IWorkContext workContext
@inject Grand.Business.Core.Interfaces.Common.Directory.IGroupService groupService
@{
//page title
@@ -19,13 +19,15 @@
var ordersAmount = priceFormatter.FormatPrice(ordersToday.Amount, false);
}
-<vc:admin-widget widget-zone="admin_dashboard_top" additional-data="null" />
+<vc:admin-widget widget-zone="admin_dashboard_top" additional-data="null"/>
@if (!Model.IsLoggedInAsVendor && canManageOrders)
{
<div class="form-row top_tiles">
<div class="animated flipInY col-lg-4 col-md-4 col-sm-6 col-12">
<div class="tile-stats">
- <div class="icon"><i class="fa fa-user"></i></div>
+ <div class="icon">
+ <i class="fa fa-user"></i>
+ </div>
<div class="count">@customersOnline</div>
<h3>
<a href="@Url.Action("List", "OnlineCustomer", new { area = Constants.AreaAdmin })">
@@ -37,7 +39,9 @@
</div>
<div class="animated flipInY col-lg-4 col-md-4 col-sm-6 col-12">
<div class="tile-stats">
- <div class="icon"><i class="fa fa-shopping-cart"></i></div>
+ <div class="icon">
+ <i class="fa fa-shopping-cart"></i>
+ </div>
<div class="count">@customersShoppingCart</div>
<h3>
<a href="@Url.Action("CurrentCarts", "ShoppingCart", new { area = Constants.AreaAdmin })">
@@ -49,7 +53,9 @@
</div>
<div class="animated flipInY col-lg-4 col-md-4 col-sm-6 col-12">
<div class="tile-stats">
- <div class="icon"><i class="fa fa-money"></i></div>
+ <div class="icon">
+ <i class="fa fa-money"></i>
+ </div>
<div class="count"> @ordersAmount / @ordersToday.Count</div>
<h3>
<a href="@Url.Action("List", "Order", new { startDate = DateTime.UtcNow.ToUniversalTime(), area = Constants.AreaAdmin })">
@@ -114,7 +120,7 @@
</div>
<div class="x_content-body">
<div class="partialContents" data-url="@Url.Action("DashboardActivity", new { area = Constants.AreaAdmin })">
- <img src="@(Common.WwwRoot)/administration/build/images/loading.gif" /> Loading ...
+ <img src="@(Common.WwwRoot)/administration/build/images/loading.gif"/> Loading ...
</div>
</div>
</div>
@@ -127,112 +133,14 @@
<div class="row">
<div class="col-md-12">
- @if (!Model.HideReportGA)
+ @if (canAccessReports)
{
- <div class="col-12 col-sm-12 col-lg-4 col-md-12 whiteBg">
- <div class="x_panel">
- <div class="x_title">
- <div class="caption level-caption">
- <i class="fa fa-line-chart font-blue"></i>
- <span class="caption-subject font-blue bold uppercase">@Loc["Admin.Dashboard.GoogleAnalytics"]</span>
- </div>
- </div>
- <div class="x_content">
- <div class="partialContents Dashboard_GoogleAnalytics_Data" data-url="@Url.Action("DashboardGeneralData", "GoogleAnalytics", new { area = Constants.AreaAdmin })">
- <img src="@(Common.WwwRoot)/administration/build/images/loading.gif" /> Loading ...
- </div>
- </div>
- </div>
+ <div class="col-sm-12 col-lg-12 col-md-12">
+ @await Component.InvokeAsync("OrderTimeChart")
</div>
- @if (canAccessReports)
- {
- <div class="col-sm-12 col-lg-8 col-md-12">
- @await Component.InvokeAsync("OrderTimeChart")
- </div>
- }
- }
- else
- {
- @if (canAccessReports)
- {
- <div class="col-sm-12 col-lg-12 col-md-12">
- @await Component.InvokeAsync("OrderTimeChart")
- </div>
- }
}
</div>
</div>
- if (!Model.HideReportGA)
- {
- <div class="row">
- <div class="col-md-12">
- <div class="col-sm-12 col-lg-6 col-md-12 whiteBg">
- <div class="x_panel">
- <div class="x_title">
- <div class="caption level-caption">
- <i class="fa fa-sign-in font-blue"></i>
- <span class="caption-subject font-blue bold uppercase">@Loc["Admin.Dashboard.GoogleAnalytics.Source"]</span>
- </div>
- </div>
- <div class="x_content">
- <div class="partialContents Dashboard_GoogleAnalytics_Data" data-url="@Url.Action("DashboardDataBySource", "GoogleAnalytics", new { area = Constants.AreaAdmin })">
- <img src="@(Common.WwwRoot)/administration/build/images/loading.gif" /> Loading ...
- </div>
- </div>
- </div>
- </div>
- <div class="col-sm-12 col-lg-6 col-md-12 whiteBg">
- <div class="x_panel">
- <div class="x_title">
- <div class="caption level-caption">
- <i class="fa fa-sign-out font-blue"></i>
- <span class="caption-subject font-blue bold uppercase">@Loc["Admin.Dashboard.GoogleAnalytics.Exit"]</span>
- </div>
- </div>
- <div class="x_content">
- <div class="partialContents Dashboard_GoogleAnalytics_Data" data-url="@Url.Action("DashboardDataByExit", "GoogleAnalytics", new { area = Constants.AreaAdmin })">
- <img src="@(Common.WwwRoot)/administration/build/images/loading.gif" /> Loading ...
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-md-12">
- <div class="col-sm-12 col-lg-6 col-md-12 whiteBg">
- <div class="x_panel">
- <div class="x_title">
- <div class="caption level-caption">
- <i class="fa fa-laptop font-blue"></i>
- <span class="caption-subject font-blue bold uppercase">@Loc["Admin.Dashboard.GoogleAnalytics.Device"]</span>
- </div>
- </div>
- <div class="x_content">
- <div class="partialContents Dashboard_GoogleAnalytics_Data" data-url="@Url.Action("DashboardDataByDevice", "GoogleAnalytics", new { area = Constants.AreaAdmin })">
- <img src="@(Common.WwwRoot)/administration/build/images/loading.gif" /> Loading ...
- </div>
- </div>
- </div>
- </div>
- <div class="col-sm-12 col-lg-6 col-md-12 whiteBg">
- <div class="x_panel">
- <div class="x_title">
- <div class="caption level-caption">
- <i class="fa fa-map-marker font-blue"></i>
- <span class="caption-subject font-blue bold uppercase">@Loc["Admin.Dashboard.GoogleAnalytics.Localization"]</span>
- </div>
- </div>
- <div class="x_content">
- <div class="partialContents Dashboard_GoogleAnalytics_Data" data-url="@Url.Action("DashboardDataByLocalization", "GoogleAnalytics", new { area = Constants.AreaAdmin })">
- <img src="@(Common.WwwRoot)/administration/build/images/loading.gif" /> Loading ...
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- }
}
@if (Model.IsLoggedInAsVendor)
{
@@ -274,7 +182,7 @@
</div>
</div>
}
-<vc:admin-widget widget-zone="admin_dashboard_bottom" additional-data="null" />
+<vc:admin-widget widget-zone="admin_dashboard_bottom" additional-data="null"/>
<script>
$(document).ready(function (e) {
var site = site || {};
@@ -366,12 +274,4 @@
if (gridOrders != undefined) {
gridOrders.dataSource.read();
}
-
- $(".Dashboard_GoogleAnalytics_Data").each(function (index, item) {
- $(item).html('<img src="@(Common.WwwRoot)/administration/build/images/loading.gif" /> Loading ...');
- var url = $(item).data("url") + '?startDate=' + $('#dashboard-report-range').data('daterangepicker').startDate.format('YYYY-MM-DD') + '&endDate=' + $('#dashboard-report-range').data('daterangepicker').endDate.format('YYYY-MM-DD');
- if (url && url.length > 0) {
- $(item).load(url);
- }
- });
- });</script>
+ });</script>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Knowledgebase/EditArticle.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Knowledgebase/EditArticle.cshtml
index ded51ab3e..1527df287 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Knowledgebase/EditArticle.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Knowledgebase/EditArticle.cshtml
@@ -16,7 +16,7 @@
</div>
<div class="actions">
<div class="btn-group btn-group-devided">
- <button type="button" onclick="window.open('@Url.RouteUrl("KnowledgebaseArticle", new {SeName = Model.SeName})','_blank');" class="btn purple">
+ <button type="button" onclick="window.open('@Url.RouteUrl("KnowledgebaseArticle", new { Model.SeName})','_blank');" class="btn purple">
<i class="fa fa-eye"></i>
@Loc["Admin.Common.Preview"]
</button>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Knowledgebase/EditCategory.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Knowledgebase/EditCategory.cshtml
index 451bde20a..443d1abbe 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Knowledgebase/EditCategory.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Knowledgebase/EditCategory.cshtml
@@ -16,7 +16,7 @@
</div>
<div class="actions">
<div class="btn-group btn-group-devided">
- <button type="button" onclick="window.open('@Url.RouteUrl("KnowledgebaseCategory", new {SeName = Model.SeName})','_blank');" class="btn purple">
+ <button type="button" onclick="window.open('@Url.RouteUrl("KnowledgebaseCategory", new { Model.SeName})','_blank');" class="btn purple">
<i class="fa fa-eye"></i>
@Loc["Admin.Common.Preview"]
</button>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Knowledgebase/Partials/CreateOrUpdateArticle.TabRelated.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Knowledgebase/Partials/CreateOrUpdateArticle.TabRelated.cshtml
index 8dfd72f6a..a763c20bd 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Knowledgebase/Partials/CreateOrUpdateArticle.TabRelated.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Knowledgebase/Partials/CreateOrUpdateArticle.TabRelated.cshtml
@@ -1,6 +1,6 @@
@model KnowledgebaseArticleModel
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<div class="panel-body">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Knowledgebase/Partials/CreateOrUpdateCategory.TabArticles.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Knowledgebase/Partials/CreateOrUpdateCategory.TabArticles.cshtml
index bf0daeede..efbdbec6d 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Knowledgebase/Partials/CreateOrUpdateCategory.TabArticles.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Knowledgebase/Partials/CreateOrUpdateCategory.TabArticles.cshtml
@@ -1,6 +1,6 @@
@model KnowledgebaseCategoryModel
@inject AdminAreaSettings adminAreaSettings
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<div class="panel-body">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Language/Partials/CreateOrUpdate.TabInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Language/Partials/CreateOrUpdate.TabInfo.cshtml
index 14cd928f2..8d468e222 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Language/Partials/CreateOrUpdate.TabInfo.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Language/Partials/CreateOrUpdate.TabInfo.cshtml
@@ -19,7 +19,7 @@
.Select(x => new SelectListItem
{
Value = x.IetfLanguageTag,
- Text = string.Format("{0}. {1}", x.EnglishName, x.IetfLanguageTag)
+ Text = $"{x.EnglishName}. {x.IetfLanguageTag}"
});
}
<admin-select asp-for="LanguageCulture" asp-items="cultures" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Language/Partials/CreateOrUpdate.TabResources.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Language/Partials/CreateOrUpdate.TabResources.cshtml
index 42c310519..4568da567 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Language/Partials/CreateOrUpdate.TabResources.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Language/Partials/CreateOrUpdate.TabResources.cshtml
@@ -3,7 +3,7 @@
@inject AdminAreaSettings adminAreaSettings
<vc:admin-widget widget-zone="language_details_resources_top" additional-data="Model" />
<div class="panel panel-default">
- @if (String.IsNullOrEmpty(Model.Id))
+ @if (string.IsNullOrEmpty(Model.Id))
{
<div class="note note-info">
@Loc["Admin.Configuration.Languages.Resources.SaveBeforeEdit"]
@@ -38,7 +38,7 @@
</div>
</div>
<vc:admin-widget widget-zone="language_details_resources_bottom" additional-data="Model" />
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<script>
@{
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Logger/View.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Logger/View.cshtml
index 12c8de367..fc85c709c 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Logger/View.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Logger/View.cshtml
@@ -3,78 +3,74 @@
//page title
ViewBag.Title = Loc["Admin.System.Log.ViewLogDetails"];
}
-<form asp-area="@Constants.AreaAdmin" asp-controller="Log" asp-action="View" method="post">
-
- <div asp-validation-summary="All"></div>
- <div class="row">
- <div class="col-md-12">
- <div class="x_panel light form-fit">
- <div class="x_title">
- <div class="caption">
- <i class="fa fa-tag"></i>
- @Loc["Admin.System.Log.ViewLogDetails"]
- <small><i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["Admin.System.Log.BackToList"], "List")</small>
- </div>
- <div class="actions">
- <span id="log-delete" class="btn red"><i class="fa fa-trash-o"></i> @Loc["Admin.Common.Delete"]</span>
- </div>
- <vc:admin-widget widget-zone="log_details_buttons" additional-data="Model" />
+<div class="row">
+ <div class="col-md-12">
+ <div class="x_panel light form-fit">
+ <div class="x_title">
+ <div class="caption">
+ <i class="fa fa-tag"></i>
+ @Loc["Admin.System.Log.ViewLogDetails"]
+ <small><i class="fa fa-arrow-circle-left"></i>@Html.ActionLink(Loc["Admin.System.Log.BackToList"], "List")</small>
+ </div>
+ <div class="actions">
+ <span id="log-delete" class="btn red"><i class="fa fa-trash-o"></i> @Loc["Admin.Common.Delete"]</span>
</div>
- <div class="x_content form">
- <div class="form-horizontal">
- <div class="form-body">
- <div class="form-group">
- <admin-label asp-for="LogLevel" />
- <div class="col-md-9 col-sm-9">
- <label class="control-label">@Model.LogLevel</label>
- </div>
+ <vc:admin-widget widget-zone="log_details_buttons" additional-data="Model" />
+ </div>
+ <div class="x_content form">
+ <div class="form-horizontal">
+ <div class="form-body">
+ <div class="form-group">
+ <admin-label asp-for="LogLevel" />
+ <div class="col-md-9 col-sm-9">
+ <label class="control-label">@Model.LogLevel</label>
</div>
- <div class="form-group">
- <admin-label asp-for="ShortMessage" />
- <div class="col-md-9 col-sm-9">
- <label class="control-label" style="text-align:left">@Model.ShortMessage</label>
- </div>
+ </div>
+ <div class="form-group">
+ <admin-label asp-for="ShortMessage" />
+ <div class="col-md-9 col-sm-9">
+ <label class="control-label" style="text-align:left">@Model.ShortMessage</label>
</div>
- <div class="form-group">
- <admin-label asp-for="FullMessage" />
- <div class="col-md-9 col-sm-9">
- <label class="control-label" style="text-align:left">@Model.FullMessage</label>
- </div>
+ </div>
+ <div class="form-group">
+ <admin-label asp-for="FullMessage" />
+ <div class="col-md-9 col-sm-9">
+ <label class="control-label" style="text-align:left">@Model.FullMessage</label>
</div>
- <div class="form-group">
- <admin-label asp-for="IpAddress" />
- <div class="col-md-9 col-sm-9">
- <label class="control-label">@Model.IpAddress</label>
- </div>
+ </div>
+ <div class="form-group">
+ <admin-label asp-for="IpAddress" />
+ <div class="col-md-9 col-sm-9">
+ <label class="control-label">@Model.IpAddress</label>
</div>
- <div class="form-group">
- <admin-label asp-for="CustomerId" />
- <div class="col-md-9 col-sm-9">
- @if (!String.IsNullOrEmpty(Model.CustomerId))
- {
- <label class="control-label">
- @Html.ActionLink(!String.IsNullOrEmpty(Model.CustomerEmail) ? Model.CustomerEmail : Loc["Admin.Customers.Guest"], "Edit", "Customer", new { id = Model.CustomerId }, new { })
- </label>
- }
- </div>
+ </div>
+ <div class="form-group">
+ <admin-label asp-for="CustomerId" />
+ <div class="col-md-9 col-sm-9">
+ @if (!string.IsNullOrEmpty(Model.CustomerId))
+ {
+ <label class="control-label">
+ @Html.ActionLink(!string.IsNullOrEmpty(Model.CustomerEmail) ? Model.CustomerEmail : Loc["Admin.Customers.Guest"], "Edit", "Customer", new { id = Model.CustomerId }, new { })
+ </label>
+ }
</div>
- <div class="form-group">
- <admin-label asp-for="PageUrl" />
- <div class="col-md-9 col-sm-9">
- <label class="control-label">@Model.PageUrl</label>
- </div>
+ </div>
+ <div class="form-group">
+ <admin-label asp-for="PageUrl" />
+ <div class="col-md-9 col-sm-9">
+ <label class="control-label">@Model.PageUrl</label>
</div>
- <div class="form-group">
- <admin-label asp-for="ReferrerUrl" />
- <div class="col-md-9 col-sm-9">
- <label class="control-label">@Model.ReferrerUrl</label>
- </div>
+ </div>
+ <div class="form-group">
+ <admin-label asp-for="ReferrerUrl" />
+ <div class="col-md-9 col-sm-9">
+ <label class="control-label">@Model.ReferrerUrl</label>
</div>
- <div class="form-group">
- <admin-label asp-for="CreatedOn" />
- <div class="col-md-9 col-sm-9">
- <label class="control-label">@Model.CreatedOn</label>
- </div>
+ </div>
+ <div class="form-group">
+ <admin-label asp-for="CreatedOn" />
+ <div class="col-md-9 col-sm-9">
+ <label class="control-label">@Model.CreatedOn</label>
</div>
</div>
</div>
@@ -82,5 +78,6 @@
</div>
</div>
</div>
-</form>
+</div>
+
<admin-delete-confirmation button-id="log-delete"/>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Login/Index.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Login/Index.cshtml
index afed6f321..c39b96891 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Login/Index.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Login/Index.cshtml
@@ -1,7 +1,7 @@
@model Grand.Web.Admin.Models.Common.LoginModel
@{
//page title
- Layout = Grand.Web.Admin.Extensions.Constants.Layout_AdminLogin;
+ Layout = Constants.Layout_AdminLogin;
}
<form asp-route="AdminLogin" asp-area="@Constants.AreaAdmin" method="post">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Login/TwoFactorAuthorization.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Login/TwoFactorAuthorization.cshtml
index a279d5a20..1ee640817 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Login/TwoFactorAuthorization.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Login/TwoFactorAuthorization.cshtml
@@ -1,6 +1,6 @@
@inject IPageHeadBuilder pagebuilder
@{
- Layout = Grand.Web.Admin.Extensions.Constants.Layout_AdminLogin;
+ Layout = Constants.Layout_AdminLogin;
//title
pagebuilder.AddTitleParts(Loc["Admin.Login.TwoFactor.Title.Login"]);
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Measure/Partials/Weights.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Measure/Partials/Weights.cshtml
index 5cb718677..58955ec4d 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Measure/Partials/Weights.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Measure/Partials/Weights.cshtml
@@ -2,14 +2,15 @@
<div class="col-md-12">
<div class="panel">
<div class="x_title">
- <div class="x_content form">
- <div class="note note-info">
- @Loc["Admin.Configuration.Measures.Weights.Description"]
- </div>
- <div class="form-horizontal">
- <div class="form-body">
- <div class="x_content">
- <div id="measureweight-grid"></div>
+ <div class="x_content form">
+ <div class="note note-info">
+ @Loc["Admin.Configuration.Measures.Weights.Description"]
+ </div>
+ <div class="form-horizontal">
+ <div class="form-body">
+ <div class="x_content">
+ <div id="measureweight-grid"></div>
+ </div>
</div>
</div>
</div>
@@ -170,5 +171,5 @@
}
});
}
- };
-</script>
+ }
+</script>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/MerchandiseReturn/Partials/CreateOrUpdate.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/MerchandiseReturn/Partials/CreateOrUpdate.cshtml
index 929eedfd4..60d58a639 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/MerchandiseReturn/Partials/CreateOrUpdate.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/MerchandiseReturn/Partials/CreateOrUpdate.cshtml
@@ -1,5 +1,4 @@
@model MerchandiseReturnModel
-@inject AdminAreaSettings adminAreaSettings
@inject OrderSettings orderSettings
@inject Grand.Business.Core.Interfaces.Common.Security.IPermissionService permissionService
@{
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/News/Edit.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/News/Edit.cshtml
index e2c5a5f12..a8974e9b0 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/News/Edit.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/News/Edit.cshtml
@@ -16,7 +16,7 @@
</div>
<div class="actions">
<div class="btn-group btn-group-devided">
- <button type="button" onclick="window.open('@Url.RouteUrl("NewsItem", new {SeName = Model.SeName})','_blank');" class="btn purple">
+ <button type="button" onclick="window.open('@Url.RouteUrl("NewsItem", new { Model.SeName})','_blank');" class="btn purple">
<i class="fa fa-eye"></i>
@Loc["Admin.Common.Preview"]
</button>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/News/Partials/CreateOrUpdate.TabComments.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/News/Partials/CreateOrUpdate.TabComments.cshtml
index 7bc32b0cf..3e55f0b5e 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/News/Partials/CreateOrUpdate.TabComments.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/News/Partials/CreateOrUpdate.TabComments.cshtml
@@ -1,7 +1,7 @@
@model NewsItemModel
@inject AdminAreaSettings adminAreaSettings
<vc:admin-widget widget-zone="news_details_comments_list" additional-data="Model" />
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<vc:admin-widget widget-zone="news_details_comments_top" additional-data="Model" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/AddProductToOrderDetails.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/AddProductToOrderDetails.cshtml
index 5f90e60fd..a00519c1d 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/AddProductToOrderDetails.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/AddProductToOrderDetails.cshtml
@@ -1,5 +1,4 @@
-@using Grand.Domain.Catalog
-@model OrderModel.AddOrderProductModel.ProductDetailsModel
+@model OrderModel.AddOrderProductModel.ProductDetailsModel
@{
ViewBag.Title = string.Format(Loc["Admin.Orders.Products.AddNew.Title2"], Model.Name, Model.OrderNumber);
}
@@ -66,8 +65,13 @@
}
@{
- var dataDictGiftVoucher = new ViewDataDictionary(ViewData);
- dataDictGiftVoucher.TemplateInfo.HtmlFieldPrefix = "giftvoucher";
+ var dataDictGiftVoucher = new ViewDataDictionary(ViewData)
+ {
+ TemplateInfo =
+ {
+ HtmlFieldPrefix = "giftvoucher"
+ }
+ };
<partial name="Partials/ProductAddGiftVoucherInfo" model="Model.GiftVoucher" view-data="dataDictGiftVoucher" />
}
<div class="form-actions">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/List.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/List.cshtml
index 6660c05c4..1623635d8 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/List.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/List.cshtml
@@ -528,10 +528,6 @@
}
</script>
</form>
-<form asp-area="@Constants.AreaAdmin" asp-controller="Order" asp-action="ExportXmlSelected" method="post" id="export-xml-selected-form">
- <input type="hidden" id="selectedIds" name="selectedIds" value="" />
-</form>
-
<script>
$(document).ready(function () {
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Addresses.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Addresses.cshtml
index 25dc8db7b..c306e1732 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Addresses.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Addresses.cshtml
@@ -1,5 +1,4 @@
@model OrderModel
-@inject Grand.Business.Core.Interfaces.Common.Security.IPermissionService permisionService;
<vc:admin-widget widget-zone="order_details_address_top" additional-data="Model" />
<div class="card col-md-6">
<div class="card-body">
@@ -138,7 +137,7 @@
</td>
</tr>
}
- @if (!String.IsNullOrEmpty(Model.BillingAddress.FormattedCustomAddressAttributes))
+ @if (!string.IsNullOrEmpty(Model.BillingAddress.FormattedCustomAddressAttributes))
{
<tr class="custom-attributes-view">
<td colspan="2">
@@ -291,7 +290,7 @@
</td>
</tr>
}
- @if (!String.IsNullOrEmpty(Model.ShippingAddress.FormattedCustomAddressAttributes))
+ @if (!string.IsNullOrEmpty(Model.ShippingAddress.FormattedCustomAddressAttributes))
{
<tr class="custom-attributes-view">
<td colspan="2">
@@ -320,7 +319,7 @@
<admin-label asp-for="PickupAddress" />
<div class="col-md-9 col-sm-9">
<table class="table table-bordered table-striped table-hover">
- @if (!String.IsNullOrEmpty(Model.PickupAddress.Address1))
+ @if (!string.IsNullOrEmpty(Model.PickupAddress.Address1))
{
<tr>
<td>
@@ -331,7 +330,7 @@
</td>
</tr>
}
- @if (!String.IsNullOrEmpty(Model.PickupAddress.City))
+ @if (!string.IsNullOrEmpty(Model.PickupAddress.City))
{
<tr>
<td>
@@ -342,7 +341,7 @@
</td>
</tr>
}
- @if (!String.IsNullOrEmpty(Model.PickupAddress.ZipPostalCode))
+ @if (!string.IsNullOrEmpty(Model.PickupAddress.ZipPostalCode))
{
<tr>
<td>
@@ -353,7 +352,7 @@
</td>
</tr>
}
- @if (!String.IsNullOrEmpty(Model.PickupAddress.CountryName))
+ @if (!string.IsNullOrEmpty(Model.PickupAddress.CountryName))
{
<tr>
<td>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Info.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Info.cshtml
index 810d1deba..3bfc874c3 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Info.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Info.cshtml
@@ -1,9 +1,7 @@
@model OrderModel
@inject IOrderTagService orderTagService
@using Grand.Domain.Tax;
-@using Grand.Domain.Orders;
@using Grand.Business.Core.Interfaces.Checkout.Orders;
-@using System.Text;
<link rel="stylesheet" type="text/css" asp-src="@(Common.WwwRoot)/administration/tagEditor/jquery.tag-editor.css" />
@@ -15,7 +13,7 @@
var orderTags = await orderTagService.GetAllOrderTags();
var orderTagsSB = new StringBuilder();
orderTagsSB.Append("var initialOrderTags = [");
- for (int i = 0; i < orderTags.Count; i++)
+ for (var i = 0; i < orderTags.Count; i++)
{
var tag = orderTags[i];
orderTagsSB.Append("'");
@@ -139,7 +137,7 @@
<div class="col-9 col-md-9 col-sm-9">
@{
var labelStatus = "";
- switch (@Model.PaymentStatusEnum)
+ switch (Model.PaymentStatusEnum)
{
case Grand.Domain.Payments.PaymentStatus.Paid:
labelStatus = "success";
@@ -242,7 +240,7 @@
<label class="control-label">@Model.CustomerIp</label>
</div>
</div>
- if (!String.IsNullOrEmpty(Model.UrlReferrer))
+ if (!string.IsNullOrEmpty(Model.UrlReferrer))
{
<div class="form-group">
<admin-label asp-for="UrlReferrer" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -251,7 +249,7 @@
</div>
</div>
}
- if (!String.IsNullOrEmpty(Model.VatNumber))
+ if (!string.IsNullOrEmpty(Model.VatNumber))
{
<div class="form-group">
<admin-label asp-for="VatNumber" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -260,7 +258,7 @@
</div>
</div>
}
- if (!String.IsNullOrEmpty(Model.AffiliateId))
+ if (!string.IsNullOrEmpty(Model.AffiliateId))
{
<div class="form-group">
<admin-label asp-for="AffiliateId" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -271,7 +269,7 @@
</div>
</div>
}
- if (!String.IsNullOrEmpty(Model.SalesEmployeeId))
+ if (!string.IsNullOrEmpty(Model.SalesEmployeeId))
{
<div class="form-group">
<admin-label asp-for="SalesEmployeeId" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -299,7 +297,7 @@
</div>
}
if (Model.TaxDisplayType == TaxDisplayType.IncludingTax
- && !String.IsNullOrEmpty(Model.OrderSubTotalDiscountInclTax))
+ && !string.IsNullOrEmpty(Model.OrderSubTotalDiscountInclTax))
{
<div class="form-group">
<admin-label asp-for="OrderSubTotalDiscountInclTax" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -309,7 +307,7 @@
</div>
}
if (Model.TaxDisplayType == TaxDisplayType.ExcludingTax
- && !String.IsNullOrEmpty(Model.OrderSubTotalDiscountExclTax))
+ && !string.IsNullOrEmpty(Model.OrderSubTotalDiscountExclTax))
{
<div class="form-group">
<admin-label asp-for="OrderSubTotalDiscountExclTax" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -337,7 +335,7 @@
</div>
}
if (Model.TaxDisplayType == TaxDisplayType.IncludingTax
- && !String.IsNullOrEmpty(Model.PaymentMethodAdditionalFeeInclTax))
+ && !string.IsNullOrEmpty(Model.PaymentMethodAdditionalFeeInclTax))
{
<div class="form-group">
<admin-label asp-for="PaymentMethodAdditionalFeeInclTax" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -347,7 +345,7 @@
</div>
}
if (Model.TaxDisplayType == TaxDisplayType.ExcludingTax
- && !String.IsNullOrEmpty(Model.PaymentMethodAdditionalFeeExclTax))
+ && !string.IsNullOrEmpty(Model.PaymentMethodAdditionalFeeExclTax))
{
<div class="form-group">
<admin-label asp-for="PaymentMethodAdditionalFeeExclTax" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -377,7 +375,7 @@
</div>
</div>
}
- if (!String.IsNullOrEmpty(Model.OrderTotalDiscount))
+ if (!string.IsNullOrEmpty(Model.OrderTotalDiscount))
{
<div class="form-group">
<admin-label asp-for="OrderTotalDiscount" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -415,7 +413,7 @@
<label class="control-label">@Model.OrderTotal</label>
</div>
</div>
- if (!String.IsNullOrEmpty(Model.RefundedAmount))
+ if (!string.IsNullOrEmpty(Model.RefundedAmount))
{
<div class="form-group">
<admin-label asp-for="RefundedAmount" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -424,7 +422,7 @@
</div>
</div>
}
- if (!String.IsNullOrEmpty(Model.SuggestedRefundedAmount))
+ if (!string.IsNullOrEmpty(Model.SuggestedRefundedAmount))
{
<div class="form-group">
<admin-label asp-for="SuggestedRefundedAmount" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
@@ -438,7 +436,7 @@
<div class="form-group">
<admin-label asp-for="UsedDiscounts" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
<div class="col-9 col-md-9 col-sm-9">
- @for (int i = 0; i < Model.UsedDiscounts.Count; i++)
+ @for (var i = 0; i < Model.UsedDiscounts.Count; i++)
{
var discount = Model.UsedDiscounts[i];
<label class="control-label">
@@ -551,7 +549,7 @@
</div>
</div>
}
- @if (Model.CustomValues != null && Model.CustomValues.Count > 0)
+ @if (Model.CustomValues is {Count: > 0 })
{
<div class="form-group">
<admin-label asp-for="CustomValues" asp-display-hint="false" class="control-label col-3 col-md-3 col-sm-3"></admin-label>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Products.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Products.cshtml
index e38f78c43..2a6ccaa89 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Products.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/OrderDetails.Products.cshtml
@@ -1,6 +1,5 @@
@model OrderModel
@using Grand.Domain.Tax;
-@using Grand.Domain.Catalog;
<vc:admin-widget widget-zone="order_details_products_top" additional-data="Model" />
<div class="table-responsive order-table">
<table class="table table-bordered table-striped table-hover">
@@ -136,7 +135,7 @@
{
<p>
@Loc["Admin.Orders.Products.MerchandiseReturns"]<text>:</text>
- @for (int i = 0; i < item.MerchandiseReturnIds.Count; i++)
+ @for (var i = 0; i < item.MerchandiseReturnIds.Count; i++)
{
<a href="@Url.Action("Edit", "MerchandiseReturn", new { id = item.MerchandiseReturnIds[i], area = Constants.AreaAdmin })" class="k-button"><span class="k-icon k-i-eye"></span>&nbsp;@Loc["Admin.Orders.MerchandiseReturns.View"]</a>
if (i != item.MerchandiseReturnIds.Count - 1)
@@ -150,7 +149,7 @@
{
<p>
@Loc["Admin.Orders.Products.GiftVouchers"]<text>:</text>
- @for (int i = 0; i < item.PurchasedGiftVoucherIds.Count; i++)
+ @for (var i = 0; i < item.PurchasedGiftVoucherIds.Count; i++)
{
<a href="@Url.Action("Edit", "GiftVoucher", new { id = item.PurchasedGiftVoucherIds[i], area = Constants.AreaAdmin })" class="k-button"><span class="k-icon k-i-eye"></span>&nbsp;@Loc["Admin.Orders.Products.GiftVoucher.View"]</a>
if (i != item.PurchasedGiftVoucherIds.Count - 1)
@@ -227,8 +226,6 @@
@item.UnitPriceInclTax
}
break;
- default:
- break;
}
<div id="pnlEditPvUnitPrice@(item.Id)">
@@ -283,8 +280,6 @@
@item.DiscountInclTax
}
break;
- default:
- break;
}
</td>
@@ -309,8 +304,6 @@
@item.SubTotalInclTax
}
break;
- default:
- break;
}
</td>
@@ -337,7 +330,7 @@
</div>
<vc:admin-widget widget-zone="order_details_products_bottom" additional-data="Model" />
-@if (!String.IsNullOrEmpty(Model.CheckoutAttributeInfo) && !Model.IsLoggedInAsVendor)
+@if (!string.IsNullOrEmpty(Model.CheckoutAttributeInfo) && !Model.IsLoggedInAsVendor)
{
<div class="note note-info">
@Html.Raw(Model.CheckoutAttributeInfo)
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/ProductAddAttributes.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/ProductAddAttributes.cshtml
index 12d87b974..b85fbab0a 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/ProductAddAttributes.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/ProductAddAttributes.cshtml
@@ -1,14 +1,12 @@
@model IList<OrderModel.AddOrderProductModel.ProductAttributeModel>
-@using Grand.Web.Common;
-@using Grand.Domain.Catalog;
@if (Model.Count > 0)
{
foreach (var attribute in Model)
{
<div class="form-group">
@{
- string controlId = string.Format("product_attribute_{0}", attribute.Id);
- string textPrompt = !string.IsNullOrEmpty(attribute.TextPrompt) ? attribute.TextPrompt : attribute.Name;
+ var controlId = $"product_attribute_{attribute.Id}";
+ var textPrompt = !string.IsNullOrEmpty(attribute.TextPrompt) ? attribute.TextPrompt : attribute.Name;
}
<label class="control-label col-md-3">
@textPrompt
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/ProductAddGiftVoucherInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/ProductAddGiftVoucherInfo.cshtml
index 6ca156006..6f77b9d5c 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/ProductAddGiftVoucherInfo.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Order/Partials/ProductAddGiftVoucherInfo.cshtml
@@ -9,7 +9,7 @@
</div>
</div>
<div class="form-group">
- @if (Model.GiftVoucherType == Grand.Domain.Catalog.GiftVoucherType.Virtual)
+ @if (Model.GiftVoucherType == GiftVoucherType.Virtual)
{
<admin-label asp-for="RecipientEmail" />
<div class="col-md-9 col-sm-9">
@@ -24,7 +24,7 @@
</div>
</div>
<div class="form-group">
- @if (Model.GiftVoucherType == Grand.Domain.Catalog.GiftVoucherType.Virtual)
+ @if (Model.GiftVoucherType == GiftVoucherType.Virtual)
{
<admin-label asp-for="SenderEmail" />
<div class="col-md-9 col-sm-9">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Page/Edit.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Page/Edit.cshtml
index d8200d0f9..f3a3a5b7e 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Page/Edit.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Page/Edit.cshtml
@@ -16,7 +16,7 @@
</div>
<div class="actions">
<div class="btn-group btn-group-devided">
- <button type="button" onclick="window.open('@Url.RouteUrl("Page", new {SeName = Model.SeName})','_blank');" class="btn purple">
+ <button type="button" onclick="window.open('@Url.RouteUrl("Page", new { Model.SeName})','_blank');" class="btn purple">
<i class="fa fa-eye"></i>
@Loc["Admin.Common.Preview"]
</button>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Payment/Partials/MethodRestrictions.TabCountry.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Payment/Partials/MethodRestrictions.TabCountry.cshtml
index c1be9eb1b..46a7fe556 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Payment/Partials/MethodRestrictions.TabCountry.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Payment/Partials/MethodRestrictions.TabCountry.cshtml
@@ -46,7 +46,7 @@
}
</tr>
@{
- bool altRow = true;
+ var altRow = true;
}
@foreach (var c in Model.AvailableCountries)
{
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Payment/Partials/MethodRestrictions.TabShipping.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Payment/Partials/MethodRestrictions.TabShipping.cshtml
index 7292998c2..ec339eec8 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Payment/Partials/MethodRestrictions.TabShipping.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Payment/Partials/MethodRestrictions.TabShipping.cshtml
@@ -46,7 +46,7 @@
}
</tr>
@{
- bool altRow = true;
+ var altRow = true;
}
@foreach (var c in Model.AvailableShippingMethods)
{
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 81ba04fd2..bc023d86c 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
@@ -76,7 +76,7 @@
<tbody>
@{
- bool altRow = true;
+ var altRow = true;
var group = Model.AvailablePermissions.GroupBy(x => x.Category);
}
@foreach (var pr in group)
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/AttributeCombinationPopup.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/AttributeCombinationPopup.cshtml
index 7a7a18805..eb6f9251f 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/AttributeCombinationPopup.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/AttributeCombinationPopup.cshtml
@@ -115,7 +115,7 @@
</tr>
</thead>
<tbody>
- @for (int i = 0; i < Model.WarehouseInventoryModels.Count; i++)
+ @for (var i = 0; i < Model.WarehouseInventoryModels.Count; i++)
{
var item = Model.WarehouseInventoryModels[i];
<tr style="height:40px;">
@@ -208,7 +208,7 @@
<li style="float: left; width: 110px;">
<p style="float: left; padding-top: 20px;">
<input type="radio" name="@Html.NameFor(x => x.PictureId)" value="0" id="id_image_0"
- @if (!String.IsNullOrEmpty(Model.PictureId)) { <text> checked="checked" </text> }>
+ @if (!string.IsNullOrEmpty(Model.PictureId)) { <text> checked="checked" </text> }>
</p>
<p style="float: left; padding-top: 20px;">
<label for="id_image_0">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Edit.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Edit.cshtml
index c10827cb4..6b5ab0c67 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Edit.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Edit.cshtml
@@ -16,7 +16,7 @@
</div>
<div class="actions">
<div class="btn-group btn-group-devided util-btn-margin-bottom-5">
- <button type="button" onclick="window.open('@Url.RouteUrl("Product", new {SeName = Model.SeName})','_blank');" class="btn purple">
+ <button type="button" onclick="window.open('@Url.RouteUrl("Product", new { Model.SeName})','_blank');" class="btn purple">
<i class="fa fa-eye"></i>
@Loc["Admin.Common.Preview"]
</button>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/List.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/List.cshtml
index a206d3ef2..c41b5db13 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/List.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/List.cshtml
@@ -1,5 +1,4 @@
-@using Grand.Domain.Catalog
-@model ProductListModel
+@model ProductListModel
@inject AdminAreaSettings adminAreaSettings
@{
//page title
@@ -427,13 +426,7 @@
});
});
</script>
-<form asp-area="@Constants.AreaAdmin" asp-controller="Product" asp-action="ExportXmlSelected" method="post" id="export-xml-selected-form">
-
- <input type="hidden" id="selectedIds" name="selectedIds" value="" />
-</form>
-
<script>
-
$(document).ready(function () {
$('#exportxml-selected').click(function (e) {
e.preventDefault();
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Activitylog.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Activitylog.cshtml
index a22572cb5..b9aca42d6 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Activitylog.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Activitylog.cshtml
@@ -1,6 +1,6 @@
@model ProductModel
@inject AdminAreaSettings adminAreaSettings
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.AssociatedProducts.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.AssociatedProducts.cshtml
index da261c3ed..25b85cdc2 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.AssociatedProducts.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.AssociatedProducts.cshtml
@@ -1,6 +1,6 @@
@model ProductModel
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="note note-info">
<p>@Loc["Admin.Catalog.Products.AssociatedProducts.Note2"]</p>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Bids.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Bids.cshtml
index 3c97e98f8..015e6771f 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Bids.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Bids.cshtml
@@ -1,6 +1,6 @@
@model ProductModel
@inject AdminAreaSettings adminAreaSettings
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<input asp-for="AuctionEnded" type="hidden" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.BundleProducts.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.BundleProducts.cshtml
index ec562097e..0da13c3a3 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.BundleProducts.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.BundleProducts.cshtml
@@ -1,7 +1,7 @@
@model ProductModel
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<vc:admin-widget widget-zone="product_details_bundle_products_top" additional-data="Model" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Calendar.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Calendar.cshtml
index 3209a4b25..f53ee5e73 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Calendar.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Calendar.cshtml
@@ -1,7 +1,6 @@
@model ProductModel
@inject AdminAreaSettings adminAreaSettings
-@using Grand.Domain.Catalog;
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<input type="hidden" asp-for="CalendarModel.ProductId" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Categories.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Categories.cshtml
index 3b939007a..8039fce64 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Categories.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Categories.cshtml
@@ -1,7 +1,7 @@
@model ProductModel
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<vc:admin-widget widget-zone="product_details_categories_top" additional-data="Model" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Collections.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Collections.cshtml
index 575303a9e..3459e21ee 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Collections.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Collections.cshtml
@@ -1,5 +1,5 @@
@model ProductModel
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<vc:admin-widget widget-zone="product_details_collections_top" additional-data="Model" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.CrossSells.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.CrossSells.cshtml
index fc1c2f7db..bd1629cf2 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.CrossSells.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.CrossSells.cshtml
@@ -1,6 +1,6 @@
@model ProductModel
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Discounts.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Discounts.cshtml
index d0596f9c4..f79f35b91 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Discounts.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Discounts.cshtml
@@ -1,6 +1,6 @@
@model ProductModel
<vc:admin-widget widget-zone="product_details_discounts_top" additional-data="Model" />
-@if (Model.AvailableDiscounts != null && Model.AvailableDiscounts.Count > 0)
+@if (Model.AvailableDiscounts is {Count: > 0 })
{
<div class="mt-checkbox-list">
@foreach (var discount in Model.AvailableDiscounts)
@@ -16,7 +16,7 @@
else
{
<div class="note note-info">
- @Html.Raw(@Loc["Admin.Catalog.Collections.Discounts.NoDiscounts"])
+ @Html.Raw(Loc["Admin.Catalog.Collections.Discounts.NoDiscounts"])
</div>
}
<vc:admin-widget widget-zone="product_details_discounts_bottom" additional-data="Model" />
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Info.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Info.cshtml
index 0445b44d6..b65c9052c 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Info.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Info.cshtml
@@ -1,7 +1,6 @@
@model ProductModel
@using Microsoft.AspNetCore.Mvc.Razor;
@inject Grand.Business.Core.Interfaces.Catalog.Products.IProductTagService productTagService
-@inject IPageHeadBuilder pagebuilder
@{
//resources for product tags input
<link rel="stylesheet" type="text/css" asp-src="@(Common.WwwRoot)/administration/tagEditor/jquery.tag-editor.css" />
@@ -9,8 +8,6 @@
<script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/tagEditor/jquery.tag-editor.min.js"></script>
}
-@using Grand.Domain.Catalog;
-@using System.Text;
<script>
$(document).ready(function() {
@@ -418,7 +415,7 @@
var productTags = await productTagService.GetAllProductTags();
var productTagsSb = new StringBuilder();
productTagsSb.Append("var initialProductTags = [");
- for (int i = 0; i < productTags.Count; i++)
+ for (var i = 0; i < productTags.Count; i++)
{
var tag = productTags[i];
productTagsSb.Append("'");
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Inventory.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Inventory.cshtml
index 6bbc22a19..3a3bd850b 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Inventory.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Inventory.cshtml
@@ -1,7 +1,4 @@
-
-@using Grand.Domain.Catalog;
-
-@model ProductModel
+@model ProductModel
<vc:admin-widget widget-zone="product_details_inventory_top" additional-data="Model" />
<div class="form-horizontal portlet bg-inverse form-fit" id="group-inventory">
<div class="form-body">
@@ -52,7 +49,7 @@
</tr>
</thead>
<tbody>
- @for (int i = 0; i < Model.ProductWarehouseInventoryModels.Count; i++)
+ @for (var i = 0; i < Model.ProductWarehouseInventoryModels.Count; i++)
{
var item = Model.ProductWarehouseInventoryModels[i];
<tr>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Pictures.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Pictures.cshtml
index e7bc72065..60e94356c 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Pictures.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Pictures.cshtml
@@ -1,6 +1,6 @@
@model ProductModel
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<vc:admin-widget widget-zone="product_details_pictures_top" additional-data="Model" />
@@ -34,13 +34,7 @@
type: "POST",
dataType: "json",
data: addAntiForgeryToken
- },
- update: {
- url:"@Html.Raw(Url.Action("ProductPictureUpdate", "Product", new { area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
+ },
destroy: {
url: "@Html.Raw(Url.Action("ProductPictureDelete", "Product", new { area = Constants.AreaAdmin }))",
type: "POST",
@@ -129,7 +123,7 @@
@{
ViewData["Reference"] = "Product";
ViewData["ObjectId"] = Model.Id;
- ViewData["Endpoint"] = this.Url.Action("ProductPictureAdd", "Product", new { area = Constants.AreaAdmin });
+ ViewData["Endpoint"] = Url.Action("ProductPictureAdd", "Product", new { area = Constants.AreaAdmin });
ViewData["Click"] = "btnRefreshProductPictures";
}
<div class="col-md-9 col-sm-9">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Prices.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Prices.cshtml
index 07a257a38..31f5c1842 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Prices.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Prices.cshtml
@@ -181,7 +181,7 @@
</div>
</div>
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<div class="panel-heading">
@@ -341,7 +341,7 @@ else
}
-@if (Model.AvailableDiscounts != null && Model.AvailableDiscounts.Count > 0)
+@if (Model.AvailableDiscounts is {Count: > 0 })
{
<div class="panel panel-default">
@@ -365,7 +365,7 @@ else
else
{
<div class="note note-info">
- @Html.Raw(@Loc["Admin.Catalog.Collections.Discounts.NoDiscounts"])
+ @Html.Raw(Loc["Admin.Catalog.Collections.Discounts.NoDiscounts"])
</div>
}
<vc:admin-widget widget-zone="product_details_prices_bottom" additional-data="Model" />
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributeCombinations.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributeCombinations.cshtml
index 66278289c..2ca96d2d0 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributeCombinations.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributeCombinations.cshtml
@@ -60,13 +60,7 @@
type: "POST",
dataType: "json",
data: addAntiForgeryToken
- },
- update: {
- url: "@Html.Raw(Url.Action("ProductAttributeCombinationUpdate", "Product", new { area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
+ },
destroy: {
url: "@Html.Raw(Url.Action("ProductAttributeCombinationDelete", "Product", new { area = Constants.AreaAdmin }))",
type: "POST",
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributes.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributes.cshtml
index f8554bf7f..c3fffc140 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributes.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductAttributes.TabAttributes.cshtml
@@ -37,19 +37,7 @@
type: "POST",
dataType: "json",
data: addAntiForgeryToken
- },
- create: {
- url: "@Html.Raw(Url.Action("ProductAttributeMappingInsert", "Product", new { productId = Model.Id, area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
- update: {
- url: "@Html.Raw(Url.Action("ProductAttributeMappingUpdate", "Product", new { area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
- },
+ },
destroy: {
url: "@Html.Raw(Url.Action("ProductAttributeMappingDelete", "Product", new { area = Constants.AreaAdmin }))",
type: "POST",
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductAttributes.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductAttributes.cshtml
index 1e0ab5629..c47a24a6f 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductAttributes.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductAttributes.cshtml
@@ -1,5 +1,5 @@
@model ProductModel
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
if (Model.AvailableProductAttributes.Count > 0)
{
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductPrices.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductPrices.cshtml
index 670801988..d02f11b2b 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.ProductPrices.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/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)
+@if (!string.IsNullOrEmpty(Model.Id) && currencies.Count > 0)
{
if (currencies.Count > 0)
{
@@ -117,7 +117,7 @@
//local datasource
var allCurrencies = [
- @for (int i = 0; i < currencies.Count; i++)
+ @for (var i = 0; i < currencies.Count; i++)
{
var currencyItem = currencies[i];
<text>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Recommended.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Recommended.cshtml
index 10246b499..51831691c 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Recommended.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.Recommended.cshtml
@@ -1,6 +1,6 @@
@model ProductModel
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.RelatedProducts.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.RelatedProducts.cshtml
index 13783fe28..797662c20 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.RelatedProducts.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.RelatedProducts.cshtml
@@ -1,7 +1,7 @@
@model ProductModel
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<div class="panel-heading">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.SimilarProducts.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.SimilarProducts.cshtml
index 5ff6e69f1..a323357d1 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.SimilarProducts.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.SimilarProducts.cshtml
@@ -1,7 +1,7 @@
@model ProductModel
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<div class="panel-heading">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.SpecificationAttributes.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.SpecificationAttributes.cshtml
index f7a28db28..13e12fda1 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.SpecificationAttributes.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.SpecificationAttributes.cshtml
@@ -1,6 +1,6 @@
@model ProductModel
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<vc:admin-widget widget-zone="product_details_specification_attribute_details_top" additional-data="Model" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.cshtml
index 48e2c897d..019fd834e 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdate.cshtml
@@ -111,7 +111,7 @@
</div>
</content>
</tabstrip-item>
- @if (!String.IsNullOrEmpty(Model.Id))
+ @if (!string.IsNullOrEmpty(Model.Id))
{
<tabstrip-item text="@Loc["Admin.Catalog.Products.ActivityLog"]" tab-index="14">
<content>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdateProductAttributeValue.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdateProductAttributeValue.cshtml
index 205d61d38..d298d00b8 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdateProductAttributeValue.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/CreateOrUpdateProductAttributeValue.cshtml
@@ -1,5 +1,4 @@
-@using Grand.Domain.Catalog
-@using Microsoft.AspNetCore.Mvc.Razor;
+@using Microsoft.AspNetCore.Mvc.Razor;
@model ProductModel.ProductAttributeValueModel
<link rel="stylesheet" type="text/css" asp-src="@(Common.WwwRoot)/administration/farbtastic/farbtastic.css" />
@@ -69,7 +68,7 @@
<div class="form-group">
<admin-label asp-for="AttributeValueTypeId" class="col-sm-3 control-label" />
<div class="col-md-9 col-sm-9">
- <admin-select asp-for="AttributeValueTypeId" asp-items="((AttributeValueType)Model.AttributeValueTypeId).ToSelectList(Context)" />
+ <admin-select asp-for="AttributeValueTypeId" asp-items="Model.AttributeValueTypeId.ToSelectList(Context)" />
<span asp-validation-for="AttributeValueTypeId"></span>
</div>
</div>
@@ -181,7 +180,7 @@
<li style="float: left; width: 110px;">
<p style="float: left; padding-top: 20px;">
<input type="radio" name="@Html.NameFor(x => x.PictureId)" value="0" id="id_image_0"
- @if (!String.IsNullOrEmpty(Model.PictureId)) { <text> checked="checked" </text> }>
+ @if (!string.IsNullOrEmpty(Model.PictureId)) { <text> checked="checked" </text> }>
</p>
<p style="float: left; padding-top: 20px;">
<label for="id_image_0">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/ProductAttributes.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/ProductAttributes.cshtml
index 1367088e1..77fd4b6bd 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/ProductAttributes.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/Partials/ProductAttributes.cshtml
@@ -1,12 +1,11 @@
@model IList<ProductAttributeCombinationModel.ProductAttributeModel>
-@using Grand.Domain.Catalog;
@if (Model.Count > 0)
{
<div class="form-group">
@foreach (var attribute in Model)
{
- string controlId = string.Format("product_attribute_{0}", attribute.Id);
- string textPrompt = !string.IsNullOrEmpty(attribute.TextPrompt) ? attribute.TextPrompt : attribute.Name;
+ var controlId = $"product_attribute_{attribute.Id}";
+ var textPrompt = !string.IsNullOrEmpty(attribute.TextPrompt) ? attribute.TextPrompt : attribute.Name;
<div class="form-group">
<div class="col-md-3 col-sm-3">
@if (attribute.IsRequired)
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/ProductAttributeConditionPopup.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/ProductAttributeConditionPopup.cshtml
index cd0736df5..3cb4e548c 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/ProductAttributeConditionPopup.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/ProductAttributeConditionPopup.cshtml
@@ -1,5 +1,4 @@
-@using Grand.Domain.Catalog
-@model ProductAttributeConditionModel
+@model ProductAttributeConditionModel
@{
Layout = "";
ViewBag.Title = Loc["Admin.Catalog.Products.ProductAttributes.Attributes.Condition"];
@@ -45,7 +44,7 @@
var attributesList = new List<SelectListItem>();
foreach (var attribute in Model.ProductAttributes)
{
- attributesList.Add(new SelectListItem { Text = attribute.Name, Value = attribute.Id.ToString() });
+ attributesList.Add(new SelectListItem { Text = attribute.Name, Value = attribute.Id });
}
<div class="form-horizontal">
<div class="form-body">
@@ -73,8 +72,8 @@
<div class="col-md-9 col-sm-9">
@foreach (var attribute in Model.ProductAttributes)
{
- string controlId = string.Format("product_attribute_{0}", attribute.Id);
- <div id="@string.Format("pnl_attribute_values_{0}", attribute.Id)">
+ var controlId = $"product_attribute_{attribute.Id}";
+ <div id="@($"pnl_attribute_values_{attribute.Id}")">
@switch (attribute.AttributeControlType)
{
case AttributeControlType.DropdownList:
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/ProductAttributeMappingPopup.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/ProductAttributeMappingPopup.cshtml
index 3cb3cf0cb..d28c8e466 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/ProductAttributeMappingPopup.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/ProductAttributeMappingPopup.cshtml
@@ -1,5 +1,4 @@
-@using Grand.Domain.Catalog
-@model ProductModel.ProductAttributeMappingModel
+@model ProductModel.ProductAttributeMappingModel
@{
Layout = "";
//page title
@@ -72,7 +71,7 @@
<div class="form-group">
<admin-label asp-for="AttributeControlType" />
<div class="col-md-9 col-sm-9">
- <admin-select asp-for="AttributeControlTypeId" asp-items="((AttributeControlType)Model.AttributeControlTypeId).ToSelectList(Context, valuesToExclude:
+ <admin-select asp-for="AttributeControlTypeId" asp-items="Model.AttributeControlTypeId.ToSelectList(Context, valuesToExclude:
new[] { (int)AttributeControlType.Hidden })" />
<span asp-validation-for="AttributeControlTypeId"></span>
</div>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/ProductAttributeValidationRulesPopup.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/ProductAttributeValidationRulesPopup.cshtml
index 6d1892a48..36a877301 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/ProductAttributeValidationRulesPopup.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/ProductAttributeValidationRulesPopup.cshtml
@@ -1,11 +1,10 @@
@model ProductModel.ProductAttributeMappingModel
-@using Grand.Domain.Catalog
@{
Layout = "";
//page title
ViewBag.Title = Loc["Admin.Catalog.Products.ProductAttributes.Attributes.ValidationRules"];
- var attributeControlType = (AttributeControlType)Model.AttributeControlTypeId;
+ var attributeControlType = Model.AttributeControlTypeId;
}
<form id="ProductAttributeValidationRulesPopup" asp-area="@Constants.AreaAdmin" asp-controller="Product" asp-action="ProductAttributeValidationRulesPopup" enctype="multipart/form-data" method="post"
asp-route-ProductId="@Context.Request.Query["ProductId"]"
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/ProductSpecAttrPopup.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/ProductSpecAttrPopup.cshtml
index 251dc5b69..9060d5098 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/ProductSpecAttrPopup.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Product/ProductSpecAttrPopup.cshtml
@@ -34,7 +34,7 @@
<div class="form-group">
<admin-label asp-for="AttributeTypeId" />
<div class="col-md-9 col-sm-9">
- <admin-select asp-for="AttributeTypeId" asp-items="((SpecificationAttributeType)Model.AttributeTypeId).ToSelectList(Context)" />
+ <admin-select asp-for="AttributeTypeId" asp-items="Model.AttributeTypeId.ToSelectList(Context)" />
<span asp-validation-for="AttributeTypeId"></span>
</div>
</div>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/PushNotifications/Messages.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/PushNotifications/Messages.cshtml
index 69de7a5fd..99ffd9e69 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/PushNotifications/Messages.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/PushNotifications/Messages.cshtml
@@ -5,7 +5,6 @@
//page title
ViewBag.Title = Loc["Admin.PushNotifications.Messages"];
}
-@using Grand.Domain.Common
<script asp-src="@(Common.WwwRoot)/administration/chart.min.js"></script>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/PushNotifications/Receivers.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/PushNotifications/Receivers.cshtml
index 98db4682d..37da1009a 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/PushNotifications/Receivers.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/PushNotifications/Receivers.cshtml
@@ -2,11 +2,9 @@
@inject AdminAreaSettings adminAreaSettings
@{
Layout = "_AdminLayout";
- var popGridPageSize = adminAreaSettings.GridPageSizes;
//page title
ViewBag.Title = Loc["Admin.PushNotifications.Receivers"];
}
-@using Grand.Domain.Common
<div class="row">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Reports/Partials/Customer.TabBestByNumberOfOrders.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Reports/Partials/Customer.TabBestByNumberOfOrders.cshtml
index cc1e394d8..972c227fc 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Reports/Partials/Customer.TabBestByNumberOfOrders.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Reports/Partials/Customer.TabBestByNumberOfOrders.cshtml
@@ -1,6 +1,11 @@
@model CustomerReportsModel
@{
- var dataDictAttributes = new ViewDataDictionary(this.ViewData);
- dataDictAttributes.TemplateInfo.HtmlFieldPrefix = "bestbynumberoforders";
+ var dataDictAttributes = new ViewDataDictionary(ViewData)
+ {
+ TemplateInfo =
+ {
+ HtmlFieldPrefix = "bestbynumberoforders"
+ }
+ };
<partial name="Partials/ReportBestCustomersByNumberOfOrders" model="Model.BestCustomersByOrderTotal" view-data="dataDictAttributes" />
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Reports/Partials/Customer.TabBestByOrderTotal.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Reports/Partials/Customer.TabBestByOrderTotal.cshtml
index a49ff79d9..eb004446b 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Reports/Partials/Customer.TabBestByOrderTotal.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Reports/Partials/Customer.TabBestByOrderTotal.cshtml
@@ -1,6 +1,11 @@
@model CustomerReportsModel
@{
- var dataDictAttributes = new ViewDataDictionary(this.ViewData);
- dataDictAttributes.TemplateInfo.HtmlFieldPrefix = "bestbyordertotal";
+ var dataDictAttributes = new ViewDataDictionary(ViewData)
+ {
+ TemplateInfo =
+ {
+ HtmlFieldPrefix = "bestbyordertotal"
+ }
+ };
<partial name="Partials/ReportBestCustomersByOrderTotal" model="Model.BestCustomersByOrderTotal" view-data="dataDictAttributes" />
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/ScheduleTask/List.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/ScheduleTask/List.cshtml
index e98459bd1..5469da785 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/ScheduleTask/List.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/ScheduleTask/List.cshtml
@@ -35,7 +35,6 @@
});
});
</script>
-<div id="schedule-tasks-grid"></div>
<script>
$(document).ready(function () {
@@ -47,12 +46,6 @@
type: "POST",
dataType: "json",
data: addAntiForgeryToken
- },
- update: {
- url: "@Html.Raw(Url.Action("TaskUpdate", "ScheduleTask", new { area = Constants.AreaAdmin }))",
- type: "POST",
- dataType: "json",
- data: addAntiForgeryToken
}
},
schema: {
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/GeneralCommon.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/GeneralCommon.cshtml
index f09d37bb2..9e1e0e7c7 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/GeneralCommon.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/GeneralCommon.cshtml
@@ -63,14 +63,7 @@
</div>
</content>
</tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Settings.GeneralCommon.GoogleAnalytics"]" tab-index="4">
- <content>
- <div>
- <partial name="Partials/GeneralCommon.TabGoogleAnalyticsSettings" model="Model" />
- </div>
- </content>
- </tabstrip-item>
- <tabstrip-item text="@Loc["Admin.Settings.GeneralCommon.DisplayMenu"]" tab-index="5">
+ <tabstrip-item text="@Loc["Admin.Settings.GeneralCommon.DisplayMenu"]" tab-index="4">
<content>
<div>
<partial name="Partials/GeneralCommon.TabMenuSettings" model="Model" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/Partials/Catalog.TabGeneralSettings.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/Partials/Catalog.TabGeneralSettings.cshtml
index 9741dc235..78c0dbcb1 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/Partials/Catalog.TabGeneralSettings.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/Partials/Catalog.TabGeneralSettings.cshtml
@@ -638,7 +638,7 @@
<span asp-validation-for="ShowProductsFromSubcategoriesInSearchBox"></span>
</div>
</div>
- <div class="form-group" id="pnlProductsByTagPageSizeOptions">
+ <div class="form-group">
<div class="col-6 col-md-6 col-sm-6">
<admin-label asp-for="DefaultCollectionPageSize" class="control-label" />
</div>
@@ -647,7 +647,7 @@
<span asp-validation-for="DefaultCollectionPageSize"></span>
</div>
</div>
- <div class="form-group" id="pnlProductsByTagPageSizeOptions">
+ <div class="form-group">
<div class="col-6 col-md-6 col-sm-6">
<admin-label asp-for="DefaultViewMode" class="control-label" />
</div>
@@ -657,7 +657,7 @@
<span asp-validation-for="DefaultViewMode"></span>
</div>
</div>
- <div class="form-group" id="pnlProductsByTagPageSizeOptions">
+ <div class="form-group">
<div class="col-6 col-md-6 col-sm-6">
<admin-label asp-for="NumberOfReview" class="control-label" />
</div>
@@ -666,7 +666,7 @@
<span asp-validation-for="NumberOfReview"></span>
</div>
</div>
- <div class="form-group" id="pnlProductsByTagPageSizeOptions">
+ <div class="form-group">
<div class="col-6 col-md-6 col-sm-6">
<admin-label asp-for="LimitOfFeaturedProducts" class="control-label" />
</div>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/Partials/Customer.TabCustomerFormFields.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/Partials/Customer.TabCustomerFormFields.cshtml
index 3ce076050..470d1c595 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/Partials/Customer.TabCustomerFormFields.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/Partials/Customer.TabCustomerFormFields.cshtml
@@ -1,5 +1,4 @@
@model CustomerSettingsModel
-@using Grand.Domain.Customers;
<script>
$(document).ready(function () {
$("#@Html.IdFor(model => model.CustomerSettings.DateOfBirthEnabled)").click(toggleCustomerRequiredFormField);
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/Partials/Customer.TabCustomerSecurity.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/Partials/Customer.TabCustomerSecurity.cshtml
index 81de52334..c0dd08864 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/Partials/Customer.TabCustomerSecurity.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/Partials/Customer.TabCustomerSecurity.cshtml
@@ -54,7 +54,7 @@
<admin-label asp-for="CustomerSettings.HashedPasswordFormat" class="control-label" />
</div>
<div class="col-4 col-md-8 col-sm-8">
- <admin-select asp-for="CustomerSettings.HashedPasswordFormat" asp-items="((HashedPasswordFormat)Model.CustomerSettings.HashedPasswordFormat).ToSelectList(Context)" />
+ <admin-select asp-for="CustomerSettings.HashedPasswordFormat" asp-items="Model.CustomerSettings.HashedPasswordFormat.ToSelectList(Context)" />
<span asp-validation-for="CustomerSettings.HashedPasswordFormat"></span>
</div>
</div>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/Partials/GeneralCommon.TabGoogleAnalyticsSettings.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/Partials/GeneralCommon.TabGoogleAnalyticsSettings.cshtml
deleted file mode 100644
index 26d92255e..000000000
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/Partials/GeneralCommon.TabGoogleAnalyticsSettings.cshtml
+++ /dev/null
@@ -1,42 +0,0 @@
-@model GeneralCommonSettingsModel
-
-<div class="form-horizontal">
- <div class="note note-info">
- <p>@Loc["Admin.Settings.GeneralCommon.GoogleAnalytics_help1"]</p>
- <p>@Loc["Admin.Settings.GeneralCommon.GoogleAnalytics_help2"]</p>
- <p>@Loc["Admin.Settings.GeneralCommon.GoogleAnalytics_help3"]</p>
- <p>@Loc["Admin.Settings.GeneralCommon.GoogleAnalytics_help4"]</p>
- <p>@Loc["Admin.Settings.GeneralCommon.GoogleAnalytics_help5"]</p>
- <p>@Loc["Admin.Settings.GeneralCommon.GoogleAnalytics_help6"]</p>
- <p>@Loc["Admin.Settings.GeneralCommon.GoogleAnalytics_help7"]</p>
- </div>
- <div class="form-body">
- <div class="form-group">
- <div class="col-8 col-md-4 col-sm-4 text-right">
- <admin-label asp-for="GoogleAnalyticsSettings.GaprivateKey" class="control-label" />
- </div>
- <div class="col-4 col-md-8 col-sm-8">
- <admin-input asp-for="GoogleAnalyticsSettings.GaprivateKey" />
- <span asp-validation-for="GoogleAnalyticsSettings.GaprivateKey"></span>
- </div>
- </div>
- <div class="form-group">
- <div class="col-8 col-md-4 col-sm-4 text-right">
- <admin-label asp-for="GoogleAnalyticsSettings.GaserviceAccountEmail" class="control-label" />
- </div>
- <div class="col-4 col-md-8 col-sm-8">
- <admin-input asp-for="GoogleAnalyticsSettings.GaserviceAccountEmail" />
- <span asp-validation-for="GoogleAnalyticsSettings.GaserviceAccountEmail"></span>
- </div>
- </div>
- <div class="form-group">
- <div class="col-8 col-md-4 col-sm-4 text-right">
- <admin-label asp-for="GoogleAnalyticsSettings.GaviewID" class="control-label" />
- </div>
- <div class="col-4 col-md-8 col-sm-8">
- <admin-input asp-for="GoogleAnalyticsSettings.GaviewID" />
- <span asp-validation-for="GoogleAnalyticsSettings.GaviewID"></span>
- </div>
- </div>
- </div>
-</div>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/SystemSetting.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/SystemSetting.cshtml
index a48c07b96..5b0c8383a 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/SystemSetting.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Setting/SystemSetting.cshtml
@@ -7,7 +7,8 @@
var languages = new List<SelectListItem>();
foreach (var item in await languageService.GetAllLanguages(true))
{
- languages.Add(new SelectListItem() {
+ languages.Add(new SelectListItem
+ {
Value = item.Id,
Text = item.Name,
Selected = item.Id == Model.DefaultAdminLanguageId
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/AdminLanguageSelector/Default.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/AdminLanguageSelector/Default.cshtml
index b725abd2d..338fbc84d 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/AdminLanguageSelector/Default.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/AdminLanguageSelector/Default.cshtml
@@ -9,7 +9,7 @@
@foreach (var lang in Model.AvailableLanguages)
{
<li>
- <a href="@Url.Action("SetLanguage", "Home", new { langid = lang.Id, returnUrl = Context?.Request?.GetEncodedPathAndQuery(), area = Constants.AreaAdmin })">
+ <a href="@Url.Action("SetLanguage", "Home", new { langid = lang.Id, returnUrl = Context.Request.GetEncodedPathAndQuery(), area = Constants.AreaAdmin })">
<img src="/assets/images/flags/@(lang.FlagImageFileName)" alt="@lang.Name">
@lang.Name
</a>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/AdminWidget/Default.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/AdminWidget/Default.cshtml
index 4b8e081c6..2f04aa21a 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/AdminWidget/Default.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/AdminWidget/Default.cshtml
@@ -1,5 +1,5 @@
@model List<AdminWidgetModel>
@foreach (var widget in Model)
{
- @await Component.InvokeAsync(widget.ViewComponentName, new { widgetZone = widget.WidgetZone, additionalData = widget.AdditionalData });
+ @await Component.InvokeAsync(widget.ViewComponentName, new { widgetZone = widget.WidgetZone, additionalData = widget.AdditionalData })
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/StoreScope/Default.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/StoreScope/Default.cshtml
index b214ac242..beef3447d 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/StoreScope/Default.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Components/StoreScope/Default.cshtml
@@ -1,6 +1,6 @@
@model StoreScopeModel
@{
- var rawUrl = Context?.Request?.GetEncodedPathAndQuery();
+ var rawUrl = Context.Request.GetEncodedPathAndQuery();
var stores = Model.Stores.Select(store => new SelectListItem
{
Text = store.Name,
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Brand.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Brand.cshtml
index 6f90e62b8..b50e05a21 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Brand.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Brand.cshtml
@@ -1,6 +1,6 @@
@model string
[email protected](model => model, new { @class = "col-md-12", @style = "width: 100%;" })
[email protected](model => model, new { @class = "col-md-12", style = "width: 100%;" })
<script>
$(document).ready(function () {
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Category.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Category.cshtml
index b20670fbd..4281ba000 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Category.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Category.cshtml
@@ -1,6 +1,6 @@
@model string
[email protected](model => model, new {@class = "col-md-8", @style="width: 100%;" })
[email protected](model => model, new {@class = "col-md-8", style="width: 100%;" })
<script>
$(document).ready(function () {
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Codemirror.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Codemirror.cshtml
index 39ca7a4a5..18f9685b6 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Codemirror.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Codemirror.cshtml
@@ -1,4 +1,4 @@
-@model String
+@model string
<div class="mt-5">
<textarea id="@Html.IdForModel()" name="@Html.NameForModel()">@Model</textarea>
</div>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Collection.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Collection.cshtml
index dd678b20c..137d1d067 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Collection.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Collection.cshtml
@@ -1,6 +1,6 @@
@model string
[email protected](model => model, new {@class = "col-md-8", @style="width: 100%;" })
[email protected](model => model, new {@class = "col-md-8", style="width: 100%;" })
<script>
$(document).ready(function () {
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Date.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Date.cshtml
index ba9b65a3d..b61d3d8a2 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Date.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Date.cshtml
@@ -4,7 +4,7 @@
<script>
$(document).ready(function () {
$("#@Html.IdForModel()").kendoDatePicker({
- //culture: "@System.Globalization.CultureInfo.CurrentCulture.Name"
+ //culture: "@CultureInfo.CurrentCulture.Name"
});
});
</script>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/DateNullable.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/DateNullable.cshtml
index 660fa83c3..4107099bd 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/DateNullable.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/DateNullable.cshtml
@@ -4,7 +4,7 @@
<script>
$(document).ready(function () {
$("#@Html.IdForModel()").kendoDatePicker({
- //culture: "@System.Globalization.CultureInfo.CurrentCulture.Name"
+ //culture: "@CultureInfo.CurrentCulture.Name"
});
});
</script>
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Decimal.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Decimal.cshtml
index 722d7154e..650640e63 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Decimal.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Decimal.cshtml
@@ -1,4 +1,4 @@
-@model Decimal
+@model decimal
@Html.TextBoxFor(model => model)
@using System.Globalization
<script>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/DecimalN4.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/DecimalN4.cshtml
index dd4a5ea7e..5d8c31b3d 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/DecimalN4.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/DecimalN4.cshtml
@@ -1,4 +1,4 @@
-@model Decimal
+@model decimal
@Html.TextBoxFor(model => model)
@using System.Globalization
<script>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/DecimalNullable.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/DecimalNullable.cshtml
index 47e4736fa..3c0ad6ae4 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/DecimalNullable.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/DecimalNullable.cshtml
@@ -1,4 +1,4 @@
-@model Decimal?
+@model decimal?
@Html.TextBoxFor(model => model)
@using System.Globalization
<script>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Double.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Double.cshtml
index ad72ffa96..b1192125a 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Double.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Double.cshtml
@@ -1,4 +1,4 @@
-@model Double
+@model double
@Html.TextBoxFor(model => model)
<script>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/DoubleN4.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/DoubleN4.cshtml
index 5bb4794bf..e67d1702b 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/DoubleN4.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/DoubleN4.cshtml
@@ -1,4 +1,4 @@
-@model Double
+@model double
@Html.TextBoxFor(model => model)
@using System.Globalization
<script>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/DoubleNullable.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/DoubleNullable.cshtml
index 69a4be4f6..5b1949395 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/DoubleNullable.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/DoubleNullable.cshtml
@@ -1,4 +1,4 @@
-@model Double?
+@model double?
@Html.TextBoxFor(model => model)
@using System.Globalization
<script>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Download.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Download.cshtml
index d37ad560d..d08050d94 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Download.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Download.cshtml
@@ -1,8 +1,5 @@
@model string
-@using Grand.SharedKernel.Extensions
-@using Grand.Web.Common.Page
@inject Grand.Business.Core.Interfaces.Storage.IDownloadService downloadService
-@inject IPageHeadBuilder pagebuilder
@{
<link rel="stylesheet" type="text/css" asp-src="@(Common.WwwRoot)/administration/fineuploader/fineuploader-4.2.2.min.css" />
<script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/fineuploader/jquery.fineuploader-4.2.2.min.js"></script>
@@ -72,7 +69,7 @@
<div class="col-md-6 col-sm-6">
<label class="mt-checkbox mt-checkbox-outline control control-checkbox control control-checkbox">
<input type="checkbox" class="check-box" name="cbUseDownloadURL@(randomNumber)" id="cbUseDownloadURL@(randomNumber)"
- @if (download != null && download.UseDownloadUrl) { <text> checked="checked" </text> } />
+ @if (download is {UseDownloadUrl: true }) { <text> checked="checked" </text> } />
<div class="control__indicator"></div>
</label>
</div>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Editor.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Editor.cshtml
index e188a524c..eda3be90e 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Editor.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Editor.cshtml
@@ -1,6 +1,5 @@
-@model String
+@model string
@inject Grand.Business.Core.Interfaces.Common.Security.IPermissionService permissionService
-@using Grand.SharedKernel.Extensions
@using Grand.Business.Core.Utilities.Common.Security
@{
var allowFileman = await permissionService.Authorize(StandardPermission.HtmlEditorManagePictures);
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Int32.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Int32.cshtml
index eedc606d4..f21e8f861 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Int32.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Int32.cshtml
@@ -1,4 +1,4 @@
-@model Int32
+@model int
@Html.TextBoxFor(model => model)
<script>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Int32Nullable.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Int32Nullable.cshtml
index 6ba6447d3..f5f86f7ec 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Int32Nullable.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Int32Nullable.cshtml
@@ -1,4 +1,4 @@
-@model Int32?
+@model int?
@Html.TextBoxFor(model => model)
<script>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Time.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Time.cshtml
index c80587407..b56c823a7 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Time.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Time.cshtml
@@ -1,5 +1,4 @@
@model DateTime
-@using System.Globalization
<input id="@Html.IdForModel()" name="@Html.NameForModel()" value="@((Model > DateTime.MinValue ? Model : DateTime.Today).ToString("HH:mm"))" />
<script>
$(document).ready(function () {
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Vendor.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Vendor.cshtml
index 80646349f..158e865e8 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Vendor.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/EditorTemplates/Vendor.cshtml
@@ -1,6 +1,6 @@
@model string
[email protected](model => model, new { @class = "col-md-12", @style = "width: 100%;" })
[email protected](model => model, new { @class = "col-md-12", style = "width: 100%;" })
<script>
$(document).ready(function () {
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/AddressAttributes.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/AddressAttributes.cshtml
index d6e06beb0..b39144d11 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/AddressAttributes.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/AddressAttributes.cshtml
@@ -1,8 +1,8 @@
@model IList<AddressModel.AddressAttributeModel>
@foreach (var attribute in Model)
{
- string controlId = string.Format("address_attribute_{0}", attribute.Id);
- string textPrompt = attribute.Name;
+ var controlId = $"address_attribute_{attribute.Id}";
+ var textPrompt = attribute.Name;
<div class="form-group">
<label class="control-label col-md-3">@textPrompt</label>
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 81a19798d..c6e137c10 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
@@ -1,5 +1,4 @@
-@using Grand.Infrastructure;
-@inject Grand.Domain.Localization.LanguageSettings languageSettings
+@inject Grand.Domain.Localization.LanguageSettings languageSettings
@inject IWorkContext workContext
<script>
const wwwrootpath = '@(Common.WwwRoot)';
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/Menu.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/Menu.cshtml
index 6c13d80ad..4edf4aeca 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/Menu.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/Menu.cshtml
@@ -1,9 +1,7 @@
@using Grand.Business.Core.Interfaces.Common.Security
-@using Grand.Business.Core.Interfaces.Common.Localization
@using Grand.Web.Common.Menu
@using Grand.Business.Core.Interfaces.System.Admin
@inject IPermissionService permissionService
-@inject ITranslationService translationService
@inject IAdminSiteMapService adminSiteMapService
@inject IEnumerable<IAdminMenuProvider> _adminMenuProviders
@{
@@ -36,7 +34,7 @@
}
//"Plugins" menu item should be visible when it has some child nodes
var pluginNode = rootNode.ChildNodes.FirstOrDefault(x => x.SystemName == "Third party plugins");
- if (pluginNode != null && pluginNode.Visible)
+ if (pluginNode is {Visible: true })
{
var hasManagePluginsPermission = await permissionService.Authorize(Grand.Business.Core.Utilities.Common.Security.StandardPermission.ManagePlugins);
pluginNode.Visible = hasManagePluginsPermission && pluginNode.ChildNodes.Any(x => x.Visible);
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/MenuItem.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/MenuItem.cshtml
index a0fefa43f..e46d58592 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/MenuItem.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/MenuItem.cshtml
@@ -2,7 +2,7 @@
@using Grand.Web.Common.Menu
@{
- string url = "javascript:;";
+ var url = "javascript:;";
if (!string.IsNullOrEmpty(Model.ControllerName) && !string.IsNullOrEmpty(Model.ActionName))
{
url = Url.Action(Model.ActionName, Model.ControllerName, new { area = Constants.AreaAdmin });
@@ -17,7 +17,7 @@
@if (childNodes.Any())
{
<a class="nav-link">
- @if (!String.IsNullOrEmpty(Model.IconClass))
+ @if (!string.IsNullOrEmpty(Model.IconClass))
{
<i class="@Model.IconClass"></i>
}
@@ -27,7 +27,7 @@
else
{
<a href="@url" class="nav-link" @(Model.OpenUrlInNewTab ? Html.Raw(" target=\"_blank\"") : null)>
- @if (!String.IsNullOrEmpty(Model.IconClass))
+ @if (!string.IsNullOrEmpty(Model.IconClass))
{
<i class="@Model.IconClass"></i>
}
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/Notifications.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/Notifications.cshtml
index fbda57b75..7eda32e28 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/Notifications.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/Notifications.cshtml
@@ -1,36 +1,36 @@
@{
//success messages
var successMessages = new List<string>();
- if (TempData[string.Format("Grand.notifications.{0}", NotifyType.Success)] != null)
+ if (TempData[$"Grand.notifications.{NotifyType.Success}"] != null)
{
- successMessages.AddRange(TempData[string.Format("Grand.notifications.{0}", NotifyType.Success)] as IList<string>);
+ successMessages.AddRange((TempData[$"Grand.notifications.{NotifyType.Success}"] as IList<string>)!);
}
- if (ViewData[string.Format("Grand.notifications.{0}", NotifyType.Success)] != null)
+ if (ViewData[$"Grand.notifications.{NotifyType.Success}"] != null)
{
- successMessages.AddRange(ViewData[string.Format("Grand.notifications.{0}", NotifyType.Success)] as IList<string>);
+ successMessages.AddRange((ViewData[$"Grand.notifications.{NotifyType.Success}"] as IList<string>)!);
}
//error messages
var errorMessages = new List<string>();
- if (TempData[string.Format("Grand.notifications.{0}", NotifyType.Error)] != null)
+ if (TempData[$"Grand.notifications.{NotifyType.Error}"] != null)
{
- errorMessages.AddRange(TempData[string.Format("Grand.notifications.{0}", NotifyType.Error)] as IList<string>);
+ errorMessages.AddRange((TempData[$"Grand.notifications.{NotifyType.Error}"] as IList<string>)!);
}
- if (ViewData[string.Format("Grand.notifications.{0}", NotifyType.Error)] != null)
+ if (ViewData[$"Grand.notifications.{NotifyType.Error}"] != null)
{
- errorMessages.AddRange(ViewData[string.Format("Grand.notifications.{0}", NotifyType.Error)] as IList<string>);
+ errorMessages.AddRange((ViewData[$"Grand.notifications.{NotifyType.Error}"] as IList<string>)!);
}
//warning messages
var warningMessages = new List<string>();
- if (TempData[string.Format("Grand.notifications.{0}", NotifyType.Warning)] != null)
+ if (TempData[$"Grand.notifications.{NotifyType.Warning}"] != null)
{
- warningMessages.AddRange(TempData[string.Format("Grand.notifications.{0}", NotifyType.Warning)] as IList<string>);
+ warningMessages.AddRange((TempData[$"Grand.notifications.{NotifyType.Warning}"] as IList<string>)!);
}
- if (ViewData[string.Format("Grand.notifications.{0}", NotifyType.Warning)] != null)
+ if (ViewData[$"Grand.notifications.{NotifyType.Warning}"] != null)
{
- warningMessages.AddRange(ViewData[string.Format("Grand.notifications.{0}", NotifyType.Warning)] as IList<string>);
+ warningMessages.AddRange((ViewData[$"Grand.notifications.{NotifyType.Warning}"] as IList<string>)!);
}
}
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/UserFields.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/UserFields.cshtml
index 5c53755db..0e885938b 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/UserFields.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/Partials/UserFields.cshtml
@@ -5,12 +5,12 @@
var stores = (await storeService.GetAllStores()).Select(store => new SelectListItem
{
Text = store.Shortcut,
- Value = store.Id,
+ Value = store.Id
}).ToList();
}
<vc:admin-widget widget-zone="userfield_details_info_top" additional-data="Model" />
<div class="form-horizontal form-userfield" id="form-userfield">
- @for (int item = 0; item < userFields.Count; item++)
+ @for (var item = 0; item < userFields.Count; item++)
{
<div id="UserFieldsItem_@item" class="form-body">
<div class="form-group">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/_AdminLayout.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/_AdminLayout.cshtml
index 1514edc6c..924516ea8 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/_AdminLayout.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/_AdminLayout.cshtml
@@ -1,18 +1,13 @@
@inject IWorkContext workContext
@inject Grand.Business.Core.Interfaces.Common.Security.IPermissionService permissionService
-@inject CommonSettings commonSettings
@inject CustomerSettings customerSettings
@inject LanguageSettings languageSettings
-@inject AdminAreaSettings adminAreaSettings
-@inject Grand.Infrastructure.Configuration.AppConfig appConfig
@inject Grand.Business.Core.Interfaces.Common.Directory.IGroupService groupService
@using System.Text.Encodings.Web
@using Grand.Domain.Customers
-@using Grand.Infrastructure;
@using Grand.Domain.Localization
@using Grand.Business.Core.Utilities.Common.Security;
-@using Grand.Domain.Common;
@{
var currentCustomer = workContext.CurrentCustomer;
var usernamesEnabled = customerSettings.UsernamesEnabled;
@@ -21,15 +16,14 @@
!languageSettings.IgnoreRtlPropertyForAdminArea;
//page title
- string adminPageTitle = "";
- if (!String.IsNullOrWhiteSpace(ViewBag.Title))
+ var adminPageTitle = "";
+ if (!string.IsNullOrWhiteSpace(ViewBag.Title))
{
adminPageTitle = ViewBag.Title + " / ";
}
adminPageTitle += Loc["Admin.PageTitle"];
//has "Manage Maintenance" permission?
- var canManageMaintenance = await permissionService.Authorize(StandardPermission.ManageMaintenance);
var canManageSystem = await permissionService.Authorize(StandardPermission.ManageSystem);
}
@@ -44,7 +38,7 @@
<resources asp-type="HeadLink" />
<resources asp-type="HeadScript" />
</head>
-<body class="nav-sm @if (IsSectionDefined("popupwindow")) { @RenderSection("popupwindow") <text>no-sidebar</text> }">
+<body class="nav-sm @if (IsSectionDefined("popupwindow")) { @await RenderSectionAsync("popupwindow") <text>no-sidebar</text> }">
@Html.AntiForgeryToken()
<script>
if (document.readyState == "loading") {
@@ -61,7 +55,7 @@
<vc:admin-widget widget-zone="admin_header_before" additional-data="null" />
@if (IsSectionDefined("headermenu"))
{
- @RenderSection("headermenu")
+ @await RenderSectionAsync("headermenu")
}
else
{
@@ -70,11 +64,11 @@
<vc:admin-widget widget-zone="admin_header_after" additional-data="null" />
@if (IsSectionDefined("statusbar"))
{
- @RenderSection("statusbar")
+ @await RenderSectionAsync("statusbar")
}
@if (IsSectionDefined("header"))
{
- @RenderSection("header")
+ @await RenderSectionAsync("header")
}
else
{
@@ -142,14 +136,14 @@
</a>
<ul id="menu1" class="dropdown-menu dropdown-menu-right list-unstyled msg_list overflow-h" role="menu">
<li>
- <a href="@Url.Action("ClearCache", "System", new { memory = true, returnurl = this.Context.Request.GetEncodedPathAndQuery(), area = Constants.AreaAdmin })">
+ <a href="@Url.Action("ClearCache", "System", new { memory = true, returnurl = Context.Request.GetEncodedPathAndQuery(), area = Constants.AreaAdmin })">
<i class="icon-refresh"></i>
@Loc["Admin.Header.ClearCacheMemory"]
</a>
</li>
<li>
- <a href="@Url.Action("RestartApplication", "System", new { returnurl = this.Context.Request.GetEncodedPathAndQuery(), area = Constants.AreaAdmin })" id="restart-application">
+ <a href="@Url.Action("RestartApplication", "System", new { returnurl = Context.Request.GetEncodedPathAndQuery(), area = Constants.AreaAdmin })" id="restart-application">
<i class="icon-reload"></i>
@Loc["Admin.Header.RestartApplication"]
</a>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/_AdminLoginLayout.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/_AdminLoginLayout.cshtml
index efe42ac89..d7b2e1248 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/_AdminLoginLayout.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/_AdminLoginLayout.cshtml
@@ -5,8 +5,8 @@
}
@{
//page title
- string adminPageTitle = "";
- if (!String.IsNullOrWhiteSpace(ViewBag.Title))
+ var adminPageTitle = "";
+ if (!string.IsNullOrWhiteSpace(ViewBag.Title))
{
adminPageTitle = ViewBag.Title + " / ";
}
@@ -26,14 +26,13 @@
<link rel="stylesheet" type="text/css" href="@(Common.WwwRoot)/administration/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="@(Common.WwwRoot)/administration/build/css/custom.css" />
- <script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/build/js/jquery.min.js"></script>
- <script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/build/js/moment.min.js"></script>
- <script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/jquery.validate.min.js"></script>
- <script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/jquery.validate.unobtrusive.min.js"></script>
- <script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/jquery-ui/jquery-ui.min.js"></script>
- <script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/bootstrap/js/popper.min.js"></script>
- <script asp-location="Head" asp-src="@(Common.WwwRoot)/administration/bootstrap/js/bootstrap.min.js"></script>
-
+ <script src="@(Common.WwwRoot)/administration/build/js/jquery.min.js"></script>
+ <script src="@(Common.WwwRoot)/administration/build/js/moment.min.js"></script>
+ <script src="@(Common.WwwRoot)/administration/jquery.validate.min.js"></script>
+ <script src="@(Common.WwwRoot)/administration/jquery.validate.unobtrusive.min.js"></script>
+ <script src="@(Common.WwwRoot)/administration/jquery-ui/jquery-ui.min.js"></script>
+ <script src="@(Common.WwwRoot)/administration/bootstrap/js/popper.min.js"></script>
+ <script src="@(Common.WwwRoot)/administration/bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
@Html.AntiForgeryToken()
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/_ConfigurePlugin.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/_ConfigurePlugin.cshtml
index 8d1f69198..ba7fbd3d5 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/_ConfigurePlugin.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shared/_ConfigurePlugin.cshtml
@@ -2,7 +2,7 @@
@using Grand.Infrastructure.Plugins
@inject IServiceProvider serviceProvider
@{
- var plugin = PluginManager.FindPlugin((this.ViewContext.ActionDescriptor as ControllerActionDescriptor).ControllerTypeInfo.AsType()).Instance(serviceProvider);
+ var plugin = PluginManager.FindPlugin((ViewContext.ActionDescriptor as ControllerActionDescriptor).ControllerTypeInfo.AsType()).Instance(serviceProvider);
//friendly name
var friendlyName = plugin?.PluginInfo.FriendlyName;
Layout = "_AdminLayout";
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipment/AddShipment.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipment/AddShipment.cshtml
index 410b637d8..bd54e8e6b 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipment/AddShipment.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipment/AddShipment.cshtml
@@ -90,7 +90,7 @@
<td>
<div style="padding-left:10px;padding-right:10px;">
<em><a href="@Url.Action("Edit", "Product", new {id = item.ProductId, area = Constants.AreaAdmin})">@item.ProductName</a></em>
- @if (!String.IsNullOrEmpty(item.AttributeInfo))
+ @if (!string.IsNullOrEmpty(item.AttributeInfo))
{
<p>
@Html.Raw(item.AttributeInfo)
@@ -119,7 +119,7 @@
<select name="warehouse_@(item.OrderItemId)" id="warehouse_@(item.OrderItemId)">
@foreach (var warehouse in item.AvailableWarehouses)
{
- var selected = warehouse.WarehouseId == item.WarehouseId ? true : false;
+ var selected = warehouse.WarehouseId == item.WarehouseId;
<option value="@(warehouse.WarehouseId)" data-stock-qty="@(warehouse.StockQuantity)"
data-reserved-qty="@(warehouse.ReservedQuantity)"
selected="@selected">
@@ -136,7 +136,7 @@
else
{
//display warehouses
- for (int i = 0; i < item.AvailableWarehouses.Count; i++)
+ for (var i = 0; i < item.AvailableWarehouses.Count; i++)
{
var warehouse = item.AvailableWarehouses[i];
@warehouse.WarehouseName
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipment/Partials/Info.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipment/Partials/Info.cshtml
index 2af2118ac..9d970d340 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipment/Partials/Info.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipment/Partials/Info.cshtml
@@ -140,13 +140,13 @@
<td>
<div style="padding-left: 10px; padding-right: 10px;">
<em><a href="@Url.Action("Edit", "Product", new { id = item.ProductId, area = Constants.AreaAdmin })">@item.ProductName</a></em>
- @if (!String.IsNullOrEmpty(item.AttributeInfo))
+ @if (!string.IsNullOrEmpty(item.AttributeInfo))
{
<p>
@Html.Raw(item.AttributeInfo)
</p>
}
- @if (!String.IsNullOrEmpty(item.RentalInfo))
+ @if (!string.IsNullOrEmpty(item.RentalInfo))
{
<p>
@Html.Raw(item.RentalInfo)
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/Restrictions.TabCountry.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/Restrictions.TabCountry.cshtml
index 88dd5ff68..9dd6eb7be 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/Restrictions.TabCountry.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/Restrictions.TabCountry.cshtml
@@ -46,7 +46,7 @@
}
</tr>
@{
- bool altRow = true;
+ var altRow = true;
}
@foreach (var c in Model.AvailableCountries)
{
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/Restrictions.TabGroup.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/Restrictions.TabGroup.cshtml
index 9a744e742..1e5458f3b 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/Restrictions.TabGroup.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Shipping/Partials/Restrictions.TabGroup.cshtml
@@ -46,7 +46,7 @@
}
</tr>
@{
- bool altRow = true;
+ var altRow = true;
}
@foreach (var c in Model.AvailableCustomerGroups)
{
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/ShoppingCart/CurrentCarts.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/ShoppingCart/CurrentCarts.cshtml
index b3950cc12..a6c5bc22e 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/ShoppingCart/CurrentCarts.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/ShoppingCart/CurrentCarts.cshtml
@@ -1,5 +1,4 @@
-@inject AdminAreaSettings adminAreaSettings
-@model ShoppingCartModel
+@model ShoppingCartModel
@{
//page title
ViewBag.Title = Loc["Admin.CurrentCartWishlists"];
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/SpecificationAttribute/Partials/CreateOrUpdate.TabOptions.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/SpecificationAttribute/Partials/CreateOrUpdate.TabOptions.cshtml
index ecd2e739d..94483d6c6 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/SpecificationAttribute/Partials/CreateOrUpdate.TabOptions.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/SpecificationAttribute/Partials/CreateOrUpdate.TabOptions.cshtml
@@ -4,7 +4,7 @@
<script asp-location="Footer" asp-src="@(Common.WwwRoot)/administration/farbtastic/farbtastic.js"></script>
@{
- if (!String.IsNullOrEmpty(Model.Id))
+ if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Store/Partials/CreateOrUpdate.TabDomains.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Store/Partials/CreateOrUpdate.TabDomains.cshtml
index 55da328bf..254326a4b 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Store/Partials/CreateOrUpdate.TabDomains.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Store/Partials/CreateOrUpdate.TabDomains.cshtml
@@ -1,5 +1,5 @@
@model StoreModel
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
<div class="panel-body">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/System/SystemInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/System/SystemInfo.cshtml
index 8324115f4..b3084dfb2 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/System/SystemInfo.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/System/SystemInfo.cshtml
@@ -140,7 +140,7 @@
@foreach (var assembly in Model.LoadedAssemblies)
{
@assembly.FullName
- if (!String.IsNullOrEmpty(assembly.Location))
+ if (!string.IsNullOrEmpty(assembly.Location))
{
<br/>
<em>@assembly.Location</em>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Vendor/Partials/CreateOrUpdate.TabDiscounts.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Vendor/Partials/CreateOrUpdate.TabDiscounts.cshtml
index b793a8158..bfaa7ef55 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Vendor/Partials/CreateOrUpdate.TabDiscounts.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Vendor/Partials/CreateOrUpdate.TabDiscounts.cshtml
@@ -1,6 +1,6 @@
@model VendorModel
@{
- if (Model.AvailableDiscounts != null && Model.AvailableDiscounts.Count > 0)
+ if (Model.AvailableDiscounts is {Count: > 0 })
{
<div class="mt-checkbox-list">
@foreach (var discount in Model.AvailableDiscounts)
@@ -16,7 +16,7 @@
else
{
<div class="note note-info">
- @Html.Raw(@Loc["Admin.Vendors.Discounts.NoDiscounts"])
+ @Html.Raw(Loc["Admin.Vendors.Discounts.NoDiscounts"])
</div>
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Vendor/Partials/CreateOrUpdate.TabDocuments.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Vendor/Partials/CreateOrUpdate.TabDocuments.cshtml
index ac2701934..ca044a060 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Vendor/Partials/CreateOrUpdate.TabDocuments.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Vendor/Partials/CreateOrUpdate.TabDocuments.cshtml
@@ -1,6 +1,6 @@
@model VendorModel
@inject AdminAreaSettings adminAreaSettings
-@if (!String.IsNullOrEmpty(Model.Id))
+@if (!string.IsNullOrEmpty(Model.Id))
{
<div class="panel panel-default">
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Vendor/Partials/CreateOrUpdate.TabInfo.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Vendor/Partials/CreateOrUpdate.TabInfo.cshtml
index 39edfd3a3..b554db675 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Vendor/Partials/CreateOrUpdate.TabInfo.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Vendor/Partials/CreateOrUpdate.TabInfo.cshtml
@@ -78,7 +78,7 @@
<label class="control-label">
@if (Model.AssociatedCustomers.Count > 0)
{
- for (int i = 0; i < Model.AssociatedCustomers.Count; i++)
+ for (var i = 0; i < Model.AssociatedCustomers.Count; i++)
{
if (!string.IsNullOrEmpty(Model.AssociatedCustomers[i].Email))
{
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Vendor/Partials/CreateOrUpdate.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Vendor/Partials/CreateOrUpdate.cshtml
index 053d467a6..86890336d 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Vendor/Partials/CreateOrUpdate.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Vendor/Partials/CreateOrUpdate.cshtml
@@ -29,7 +29,7 @@
</div>
</content>
</tabstrip-item>
- @if (!String.IsNullOrEmpty(Model.Id))
+ @if (!string.IsNullOrEmpty(Model.Id))
{
<tabstrip-item text="@Loc["Admin.Vendors.VendorNotes"]" tab-index="3">
<content>
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/VendorReview/Edit.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/VendorReview/Edit.cshtml
index f50c6e887..b97797044 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/VendorReview/Edit.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/VendorReview/Edit.cshtml
@@ -1,5 +1,4 @@
@model VendorReviewModel
-@using Grand.Infrastructure
@inject IWorkContext workContext
@{
//page title
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/VendorReview/Partials/CreateOrUpdate.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/VendorReview/Partials/CreateOrUpdate.cshtml
index 08d40e2dc..f1c9f0baf 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/VendorReview/Partials/CreateOrUpdate.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/VendorReview/Partials/CreateOrUpdate.cshtml
@@ -1,5 +1,4 @@
@model VendorReviewModel
-@using Grand.Infrastructure
@inject IWorkContext workContext
@Html.ValidationSummary(false)
<input asp-for="Id" type="hidden" />
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/_ViewStart.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/_ViewStart.cshtml
index 7c5f2bffb..97eac98b8 100644
--- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/_ViewStart.cshtml
+++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/_ViewStart.cshtml
@@ -1,3 +1,4 @@
-@{
+@using Grand.Web.Admin.Extensions
+@{
Layout = Constants.Layout_Admin;
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Components/AdminLanguageSelector.cs b/src/Web/Grand.Web.Admin/Components/AdminLanguageSelector.cs
index b9eeb0962..95c6f1282 100644
--- a/src/Web/Grand.Web.Admin/Components/AdminLanguageSelector.cs
+++ b/src/Web/Grand.Web.Admin/Components/AdminLanguageSelector.cs
@@ -1,7 +1,7 @@
using Grand.Infrastructure;
using Grand.Web.Common.Components;
using Grand.Business.Core.Interfaces.Common.Localization;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Models.Common;
using Microsoft.AspNetCore.Mvc;
@@ -22,14 +22,15 @@ namespace Grand.Web.Admin.Components
public async Task<IViewComponentResult> InvokeAsync()
{
- var model = new LanguageSelectorModel();
- model.CurrentLanguage = _workContext.WorkingLanguage.ToModel();
- model.AvailableLanguages = (await _languageService
- .GetAllLanguages(
- showHidden: true,
- storeId: _workContext.CurrentStore.Id))
- .Select(x => x.ToModel())
- .ToList();
+ var model = new LanguageSelectorModel {
+ CurrentLanguage = _workContext.WorkingLanguage.ToModel(),
+ AvailableLanguages = (await _languageService
+ .GetAllLanguages(
+ showHidden: true,
+ storeId: _workContext.CurrentStore.Id))
+ .Select(x => x.ToModel())
+ .ToList()
+ };
return View(model);
}
}
diff --git a/src/Web/Grand.Web.Admin/Components/AdminWidget.cs b/src/Web/Grand.Web.Admin/Components/AdminWidget.cs
index d5dd1f738..74177cdb6 100644
--- a/src/Web/Grand.Web.Admin/Components/AdminWidget.cs
+++ b/src/Web/Grand.Web.Admin/Components/AdminWidget.cs
@@ -37,7 +37,7 @@ namespace Grand.Web.Admin.Components
var viewComponentName = await item.GetPublicViewComponentName(widgetZone);
var widgetModel = new AdminWidgetModel {
WidgetZone = widgetZone,
- ViewComponentName = viewComponentName,
+ ViewComponentName = viewComponentName
};
model.Add(widgetModel);
}
diff --git a/src/Web/Grand.Web.Admin/Components/Affiliate.cs b/src/Web/Grand.Web.Admin/Components/Affiliate.cs
index c180ebbed..30504bf92 100644
--- a/src/Web/Grand.Web.Admin/Components/Affiliate.cs
+++ b/src/Web/Grand.Web.Admin/Components/Affiliate.cs
@@ -33,15 +33,16 @@ namespace Grand.Web.Admin.Components
if (!await _permissionService.Authorize(StandardPermission.ManageAffiliates))
return Content("");
- if (String.IsNullOrEmpty(affiliateId))
+ if (string.IsNullOrEmpty(affiliateId))
throw new Exception("Affliate ID cannot be empty");
- var model = new AffiliatedOrderListModel();
- model.AffliateId = affiliateId;
+ var model = new AffiliatedOrderListModel {
+ AffliateId = affiliateId
+ };
var status = await _orderStatusService.GetAll();
//order statuses
- model.AvailableOrderStatuses = status.Select(x => new SelectListItem() { Value = x.StatusId.ToString(), Text = x.Name }).ToList();
+ model.AvailableOrderStatuses = status.Select(x => new SelectListItem { Value = x.StatusId.ToString(), Text = x.Name }).ToList();
model.AvailableOrderStatuses.Insert(0, new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" });
//payment statuses
diff --git a/src/Web/Grand.Web.Admin/Components/StoreScope.cs b/src/Web/Grand.Web.Admin/Components/StoreScope.cs
index 65c4a7f1f..edbbe6955 100644
--- a/src/Web/Grand.Web.Admin/Components/StoreScope.cs
+++ b/src/Web/Grand.Web.Admin/Components/StoreScope.cs
@@ -59,11 +59,11 @@ namespace Grand.Web.Admin.Components
#region Methods
- private async Task<string> GetActiveStore(IList<Store> stores)
+ private async Task<string> GetActiveStore(ICollection<Store> stores)
{
//ensure that we have 2 (or more) stores
if (stores.Count < 2)
- return stores.FirstOrDefault().Id;
+ return stores.FirstOrDefault()!.Id;
var storeId = _workContext.CurrentCustomer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.AdminAreaStoreScopeConfiguration);
var store = await _storeService.GetStoreById(storeId);
diff --git a/src/Web/Grand.Web.Admin/Controllers/ActivityLogController.cs b/src/Web/Grand.Web.Admin/Controllers/ActivityLogController.cs
index 30b511fb3..046878c81 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ActivityLogController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ActivityLogController.cs
@@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.ActivityLog)]
- public partial class ActivityLogController : BaseAdminController
+ public class ActivityLogController : BaseAdminController
{
#region Fields
@@ -45,8 +45,8 @@ namespace Grand.Web.Admin.Controllers
[PermissionAuthorizeAction(PermissionActionName.Edit)]
public async Task<IActionResult> SaveTypes(IFormCollection form)
{
- string formKey = "checkbox_activity_types";
- var checkedActivityTypes = form[formKey].ToString() != null ? form[formKey].ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x).ToList() : new List<string>();
+ var formKey = "checkbox_activity_types";
+ var checkedActivityTypes = form[formKey].ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x).ToList();
await _activityLogViewModelService.SaveTypes(checkedActivityTypes);
diff --git a/src/Web/Grand.Web.Admin/Controllers/AddressAttributeController.cs b/src/Web/Grand.Web.Admin/Controllers/AddressAttributeController.cs
index 0616d3c77..b4b06542c 100644
--- a/src/Web/Grand.Web.Admin/Controllers/AddressAttributeController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/AddressAttributeController.cs
@@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.AddressAttributes)]
- public partial class AddressAttributeController : BaseAdminController
+ public class AddressAttributeController : BaseAdminController
{
#region Fields
diff --git a/src/Web/Grand.Web.Admin/Controllers/AffiliateController.cs b/src/Web/Grand.Web.Admin/Controllers/AffiliateController.cs
index e92bf250f..6b033bc92 100644
--- a/src/Web/Grand.Web.Admin/Controllers/AffiliateController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/AffiliateController.cs
@@ -15,7 +15,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Affiliates)]
- public partial class AffiliateController : BaseAdminController
+ public class AffiliateController : BaseAdminController
{
#region Fields
@@ -62,7 +62,7 @@ namespace Grand.Web.Admin.Controllers
var gridModel = new DataSourceResult
{
Data = affiliatesModel.affiliateModels,
- Total = affiliatesModel.totalCount,
+ Total = affiliatesModel.totalCount
};
return Json(gridModel);
}
@@ -147,19 +147,17 @@ namespace Grand.Web.Admin.Controllers
//No affiliate found with the specified id
return RedirectToAction("List");
- var customers = new GetCustomerQuery()
- {
+ var customers = new GetCustomerQuery {
AffiliateId = affiliate.Id,
- PageSize = 1,
+ PageSize = 1
};
var query_customer = (await _mediator.Send(customers)).Count();
if (query_customer > 0)
ModelState.AddModelError("", "There are exist customers related with affiliate");
- var orders = new GetOrderQuery()
- {
+ var orders = new GetOrderQuery {
AffiliateId = affiliate.Id,
- PageSize = 1,
+ PageSize = 1
};
var query_order = (await _mediator.Send(orders)).Count();
diff --git a/src/Web/Grand.Web.Admin/Controllers/ApiUserController.cs b/src/Web/Grand.Web.Admin/Controllers/ApiUserController.cs
index 9ad5d7cdd..43f92a7d1 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ApiUserController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ApiUserController.cs
@@ -5,14 +5,14 @@ using Grand.Web.Common.DataSource;
using Grand.Web.Common.Extensions;
using Grand.Web.Common.Security.Authorization;
using Grand.SharedKernel.Extensions;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Models.Customers;
using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Maintenance)]
- public partial class ApiUserController : BaseAdminController
+ public class ApiUserController : BaseAdminController
{
private readonly IUserApiService _userApiService;
private readonly IEncryptionService _encryptionService;
diff --git a/src/Web/Grand.Web.Admin/Controllers/BaseAdminController.cs b/src/Web/Grand.Web.Admin/Controllers/BaseAdminController.cs
index 7093e9b5c..e8b26b39a 100644
--- a/src/Web/Grand.Web.Admin/Controllers/BaseAdminController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/BaseAdminController.cs
@@ -16,7 +16,7 @@ namespace Grand.Web.Admin.Controllers
[AutoValidateAntiforgeryToken]
[Area(Constants.AreaAdmin)]
[AuthorizeVendor]
- public abstract partial class BaseAdminController : BaseController
+ public abstract class BaseAdminController : BaseController
{
/// <summary>
@@ -28,12 +28,11 @@ namespace Grand.Web.Admin.Controllers
{
if (!index.HasValue)
{
- int tmp;
var form = await HttpContext.Request.ReadFormAsync();
var tabindex = form["selected-tab-index"];
if (tabindex.Count > 0)
{
- if (int.TryParse(tabindex[0], out tmp))
+ if (int.TryParse(tabindex[0], out var tmp))
{
index = tmp;
}
@@ -43,7 +42,7 @@ namespace Grand.Web.Admin.Controllers
}
if (index.HasValue)
{
- string dataKey = "Grand.selected-tab-index";
+ var dataKey = "Grand.selected-tab-index";
if (persistForTheNextRequest)
{
TempData[dataKey] = index;
@@ -58,10 +57,8 @@ namespace Grand.Web.Admin.Controllers
/// <summary>
/// Get active store scope (for multi-store configuration mode)
/// </summary>
- /// <param name="storeService">Store service</param>
- /// <param name="workContext">Work context</param>
/// <returns>Store ID; 0 if we are in a shared mode</returns>
- protected virtual async Task<string> GetActiveStore()
+ protected async Task<string> GetActiveStore()
{
var storeService = HttpContext.RequestServices.GetRequiredService<IStoreService>();
var workContext = HttpContext.RequestServices.GetRequiredService<IWorkContext>();
@@ -69,7 +66,7 @@ namespace Grand.Web.Admin.Controllers
var stores = await storeService.GetAllStores();
if (stores.Count < 2)
- return stores.FirstOrDefault().Id;
+ return stores.FirstOrDefault()?.Id;
if (await groupService.IsStaff(workContext.CurrentCustomer))
{
@@ -77,14 +74,11 @@ namespace Grand.Web.Admin.Controllers
}
var storeId = workContext.CurrentCustomer.GetUserFieldFromEntity<string>(SystemCustomerFieldNames.AdminAreaStoreScopeConfiguration);
- if(!string.IsNullOrEmpty(storeId))
- {
- var store = await storeService.GetStoreById(storeId);
- if (store != null)
- return store.Id;
- }
- return stores.FirstOrDefault().Id;
+ if (string.IsNullOrEmpty(storeId)) return stores.FirstOrDefault()?.Id;
+ var store = await storeService.GetStoreById(storeId);
+ return store != null ? store.Id : stores.FirstOrDefault()?.Id;
}
+
/// <summary>
/// Creates a <see cref="T:System.Web.Mvc.JsonResult"/> object that serializes the specified object to JavaScript Object Notation (JSON) format using the content type, content encoding, and the JSON request behavior.
/// </summary>
@@ -93,9 +87,6 @@ namespace Grand.Web.Admin.Controllers
/// The result object that serializes the specified object to JSON format.
/// </returns>
/// <param name="data">The JavaScript object graph to serialize.</param>
- /// <param name="contentType">The content type (MIME type).</param>
- /// <param name="contentEncoding">The content encoding.</param>
- /// <param name="behavior">The JSON request behavior</param>
public override JsonResult Json(object data)
{
var serializerSettings = new JsonSerializerSettings {
diff --git a/src/Web/Grand.Web.Admin/Controllers/BlogController.cs b/src/Web/Grand.Web.Admin/Controllers/BlogController.cs
index feaf8e79b..2c2153025 100644
--- a/src/Web/Grand.Web.Admin/Controllers/BlogController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/BlogController.cs
@@ -7,6 +7,7 @@ using Grand.Business.Core.Utilities.Common.Security;
using Grand.Domain.Seo;
using Grand.Infrastructure;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Blogs;
using Grand.Web.Admin.Models.Common;
@@ -19,7 +20,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Blog)]
- public partial class BlogController : BaseAdminController
+ public class BlogController : BaseAdminController
{
#region Fields
@@ -87,9 +88,10 @@ namespace Grand.Web.Admin.Controllers
public async Task<IActionResult> Create()
{
ViewBag.AllLanguages = await _languageService.GetAllLanguages(true);
- var model = new BlogPostModel();
- //default values
- model.AllowComments = true;
+ var model = new BlogPostModel {
+ //default values
+ AllowComments = true
+ };
//locales
await AddLocales(_languageService, model.Locales);
@@ -104,7 +106,7 @@ namespace Grand.Web.Admin.Controllers
{
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
- model.Stores = new string[] { _workContext.CurrentCustomer.StaffStoreId };
+ model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };
}
var blogPost = await _blogViewModelService.InsertBlogPostModel(model);
Success(_translationService.GetResource("Admin.Content.Blog.BlogPosts.Added"));
@@ -170,7 +172,7 @@ namespace Grand.Web.Admin.Controllers
{
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
- model.Stores = new string[] { _workContext.CurrentCustomer.StaffStoreId };
+ model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };
}
blogPost = await _blogViewModelService.UpdateBlogPostModel(model, blogPost);
@@ -309,7 +311,7 @@ namespace Grand.Web.Admin.Controllers
{
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
- model.Stores = new string[] { _workContext.CurrentCustomer.StaffStoreId };
+ model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };
}
var blogCategory = model.ToEntity();
@@ -375,7 +377,7 @@ namespace Grand.Web.Admin.Controllers
{
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
- model.Stores = new string[] { _workContext.CurrentCustomer.StaffStoreId };
+ model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };
}
blogCategory = model.ToEntity(blogCategory);
@@ -441,9 +443,10 @@ namespace Grand.Web.Admin.Controllers
var blogposts = new List<BlogCategoryPost>();
foreach (var item in blogCategory.BlogPosts)
{
- var post = new BlogCategoryPost();
- post.Id = item.Id;
- post.BlogPostId = item.BlogPostId;
+ var post = new BlogCategoryPost {
+ Id = item.Id,
+ BlogPostId = item.BlogPostId
+ };
var _post = await _blogService.GetBlogPostById(item.BlogPostId);
if (_post != null)
post.Name = _post.Title;
@@ -493,7 +496,7 @@ namespace Grand.Web.Admin.Controllers
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var s in (await _storeService.GetAllStores()).Where(x => x.Id == storeId || string.IsNullOrWhiteSpace(storeId)))
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
model.CategoryId = categoryId;
return View(model);
}
@@ -509,7 +512,7 @@ namespace Grand.Web.Admin.Controllers
}
var posts = await _blogService.GetAllBlogPosts(storeId: model.SearchStoreId, blogPostName: model.SearchBlogTitle, pageIndex: command.Page - 1, pageSize: command.PageSize);
- gridModel.Data = posts.Select(x => new { Id = x.Id, Name = x.Title });
+ gridModel.Data = posts.Select(x => new { x.Id, Name = x.Title });
gridModel.Total = posts.TotalCount;
return Json(gridModel);
@@ -523,14 +526,14 @@ namespace Grand.Web.Admin.Controllers
{
var blogCategory = await _blogService.GetBlogCategoryById(model.CategoryId);
if (blogCategory != null)
- foreach (string id in model.SelectedBlogPostIds)
+ foreach (var id in model.SelectedBlogPostIds)
{
var post = _blogService.GetBlogPostById(id);
if (post != null)
{
- if (blogCategory.BlogPosts.Where(x => x.BlogPostId == id).Count() == 0)
+ if (!blogCategory.BlogPosts.Any(x => x.BlogPostId == id))
{
- blogCategory.BlogPosts.Add(new Domain.Blogs.BlogCategoryPost() { BlogPostId = id });
+ blogCategory.BlogPosts.Add(new Domain.Blogs.BlogCategoryPost { BlogPostId = id });
await _blogService.UpdateBlogCategory(blogCategory);
}
}
@@ -558,7 +561,7 @@ namespace Grand.Web.Admin.Controllers
var gridModel = new DataSourceResult
{
Data = model.blogComments,
- Total = model.totalCount,
+ Total = model.totalCount
};
return Json(gridModel);
}
@@ -600,7 +603,7 @@ namespace Grand.Web.Admin.Controllers
var gridModel = new DataSourceResult
{
Data = model.blogProducts,
- Total = model.totalCount,
+ Total = model.totalCount
};
return Json(gridModel);
}
diff --git a/src/Web/Grand.Web.Admin/Controllers/BrandController.cs b/src/Web/Grand.Web.Admin/Controllers/BrandController.cs
index 616407c75..8e4cda031 100644
--- a/src/Web/Grand.Web.Admin/Controllers/BrandController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/BrandController.cs
@@ -9,6 +9,7 @@ using Grand.Business.Core.Utilities.Common.Security;
using Grand.Domain.Catalog;
using Grand.Infrastructure;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Catalog;
using Grand.Web.Admin.Models.Common;
@@ -22,7 +23,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Brands)]
- public partial class BrandController : BaseAdminController
+ public class BrandController : BaseAdminController
{
#region Fields
@@ -89,7 +90,7 @@ namespace Grand.Web.Admin.Controllers
var model = new BrandListModel();
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" });
foreach (var s in (await _storeService.GetAllStores()).Where(x => x.Id == storeId || string.IsNullOrWhiteSpace(storeId)))
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
return View(model);
}
@@ -145,7 +146,7 @@ namespace Grand.Web.Admin.Controllers
{
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
- model.Stores = new string[] { _workContext.CurrentCustomer.StaffStoreId };
+ model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };
}
var collection = await _brandViewModelService.InsertBrandModel(model);
@@ -223,7 +224,7 @@ namespace Grand.Web.Admin.Controllers
{
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
- model.Stores = new string[] { _workContext.CurrentCustomer.StaffStoreId };
+ model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };
}
brand = await _brandViewModelService.UpdateBrandModel(brand, model);
Success(_translationService.GetResource("Admin.Catalog.Brands.Updated"));
@@ -356,7 +357,7 @@ namespace Grand.Web.Admin.Controllers
try
{
- if (importexcelfile != null && importexcelfile.Length > 0)
+ if (importexcelfile is { Length: > 0 })
{
await importManager.Import(importexcelfile.OpenReadStream());
}
diff --git a/src/Web/Grand.Web.Admin/Controllers/CampaignController.cs b/src/Web/Grand.Web.Admin/Controllers/CampaignController.cs
index 9a65c3783..6b7ac41b1 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CampaignController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CampaignController.cs
@@ -18,7 +18,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Campaigns)]
- public partial class CampaignController : BaseAdminController
+ public class CampaignController : BaseAdminController
{
private readonly ICampaignService _campaignService;
private readonly ICampaignViewModelService _campaignViewModelService;
@@ -87,8 +87,8 @@ namespace Grand.Web.Admin.Controllers
var gridModel = new DataSourceResult {
Data = history.Select(x => new
{
- Email = x.Email,
- SentDate = x.CreatedDateUtc,
+ x.Email,
+ SentDate = x.CreatedDateUtc
}),
Total = history.TotalCount
};
@@ -109,7 +109,8 @@ namespace Grand.Web.Admin.Controllers
sb.Append(subscription);
sb.Append(Environment.NewLine); //new line
}
- var fileName = string.Format("newsletter_emails_campaign_{0}_{1}.txt", campaign.Name, CommonHelper.GenerateRandomDigitCode(4));
+ var fileName =
+ $"newsletter_emails_campaign_{campaign.Name}_{CommonHelper.GenerateRandomDigitCode(4)}.txt";
return File(Encoding.UTF8.GetBytes(sb.ToString()), "text/csv", fileName);
}
catch (Exception exc)
@@ -242,7 +243,6 @@ namespace Grand.Web.Admin.Controllers
//subscribers of certain store?
var store = await _storeService.GetStoreById(campaign.StoreId);
- var storeId = store != null ? store.Id : "";
var subscriptions = await _campaignService.CustomerSubscriptions(campaign);
var totalEmailsSent = await _campaignService.SendCampaign(campaign, emailAccount, subscriptions);
Success(string.Format(_translationService.GetResource("admin.marketing.Campaigns.MassEmailSentToCustomers"), totalEmailsSent), false);
diff --git a/src/Web/Grand.Web.Admin/Controllers/CategoryController.cs b/src/Web/Grand.Web.Admin/Controllers/CategoryController.cs
index 42917d63e..c161f2604 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CategoryController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CategoryController.cs
@@ -8,6 +8,7 @@ using Grand.Business.Core.Utilities.Common.Security;
using Grand.Domain.Catalog;
using Grand.Infrastructure;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Catalog;
using Grand.Web.Admin.Models.Common;
@@ -20,7 +21,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Categories)]
- public partial class CategoryController : BaseAdminController
+ public class CategoryController : BaseAdminController
{
#region Fields
@@ -122,7 +123,7 @@ namespace Grand.Web.Admin.Controllers
{
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
- model.Stores = new string[] { _workContext.CurrentCustomer.StaffStoreId };
+ model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };
}
var category = await _categoryViewModelService.InsertCategoryModel(model);
@@ -192,7 +193,7 @@ namespace Grand.Web.Admin.Controllers
{
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
- model.Stores = new string[] { _workContext.CurrentCustomer.StaffStoreId };
+ model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };
}
category = await _categoryViewModelService.UpdateCategoryModel(category, model);
@@ -315,7 +316,7 @@ namespace Grand.Web.Admin.Controllers
try
{
- if (importexcelfile != null && importexcelfile.Length > 0)
+ if (importexcelfile is { Length: > 0 })
{
await importManager.Import(importexcelfile.OpenReadStream());
}
diff --git a/src/Web/Grand.Web.Admin/Controllers/CheckoutAttributeController.cs b/src/Web/Grand.Web.Admin/Controllers/CheckoutAttributeController.cs
index d89e072da..cfc1ba449 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CheckoutAttributeController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CheckoutAttributeController.cs
@@ -8,7 +8,7 @@ using Grand.Business.Core.Utilities.Common.Security;
using Grand.Domain.Catalog;
using Grand.Domain.Directory;
using Grand.Infrastructure;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Orders;
using Grand.Web.Common.DataSource;
@@ -19,7 +19,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.CheckoutAttributes)]
- public partial class CheckoutAttributeController : BaseAdminController
+ public class CheckoutAttributeController : BaseAdminController
{
#region Fields
@@ -219,7 +219,7 @@ namespace Grand.Web.Admin.Controllers
if (checkoutAttribute.AttributeControlTypeId == AttributeControlType.ColorSquares)
{
//ensure valid color is chosen/entered
- if (String.IsNullOrEmpty(model.ColorSquaresRgb))
+ if (string.IsNullOrEmpty(model.ColorSquaresRgb))
ModelState.AddModelError("", "Color is required");
}
@@ -238,7 +238,7 @@ namespace Grand.Web.Admin.Controllers
public async Task<IActionResult> ValueEditPopup(string id, string checkoutAttributeId)
{
var checkoutAttribute = await _checkoutAttributeService.GetCheckoutAttributeById(checkoutAttributeId);
- var cav = checkoutAttribute.CheckoutAttributeValues.Where(x => x.Id == id).FirstOrDefault();
+ var cav = checkoutAttribute.CheckoutAttributeValues.FirstOrDefault(x => x.Id == id);
if (cav == null)
//No checkout attribute value found with the specified id
return RedirectToAction("List");
@@ -260,7 +260,7 @@ namespace Grand.Web.Admin.Controllers
{
var checkoutAttribute = await _checkoutAttributeService.GetCheckoutAttributeById(model.CheckoutAttributeId);
- var cav = checkoutAttribute.CheckoutAttributeValues.Where(x => x.Id == model.Id).FirstOrDefault();
+ var cav = checkoutAttribute.CheckoutAttributeValues.FirstOrDefault(x => x.Id == model.Id);
if (cav == null)
//No checkout attribute value found with the specified id
return RedirectToAction("List");
@@ -271,7 +271,7 @@ namespace Grand.Web.Admin.Controllers
if (checkoutAttribute.AttributeControlTypeId == AttributeControlType.ColorSquares)
{
//ensure valid color is chosen/entered
- if (String.IsNullOrEmpty(model.ColorSquaresRgb))
+ if (string.IsNullOrEmpty(model.ColorSquaresRgb))
ModelState.AddModelError("", "Color is required");
}
@@ -291,7 +291,7 @@ namespace Grand.Web.Admin.Controllers
public async Task<IActionResult> ValueDelete(string id, string checkoutAttributeId)
{
var checkoutAttribute = await _checkoutAttributeService.GetCheckoutAttributeById(checkoutAttributeId);
- var cav = checkoutAttribute.CheckoutAttributeValues.Where(x => x.Id == id).FirstOrDefault();
+ var cav = checkoutAttribute.CheckoutAttributeValues.FirstOrDefault(x => x.Id == id);
if (cav == null)
throw new ArgumentException("No checkout attribute value found with the specified id");
diff --git a/src/Web/Grand.Web.Admin/Controllers/CollectionController.cs b/src/Web/Grand.Web.Admin/Controllers/CollectionController.cs
index a92328a9b..6b7e99f4a 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CollectionController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CollectionController.cs
@@ -9,6 +9,7 @@ using Grand.Business.Core.Utilities.Common.Security;
using Grand.Domain.Catalog;
using Grand.Infrastructure;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Catalog;
using Grand.Web.Admin.Models.Common;
@@ -22,7 +23,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Collections)]
- public partial class CollectionController : BaseAdminController
+ public class CollectionController : BaseAdminController
{
#region Fields
@@ -89,7 +90,7 @@ namespace Grand.Web.Admin.Controllers
var model = new CollectionListModel();
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" });
foreach (var s in (await _storeService.GetAllStores()).Where(x => x.Id == storeId || string.IsNullOrWhiteSpace(storeId)))
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
return View(model);
}
@@ -145,7 +146,7 @@ namespace Grand.Web.Admin.Controllers
{
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
- model.Stores = new string[] { _workContext.CurrentCustomer.StaffStoreId };
+ model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };
}
var collection = await _collectionViewModelService.InsertCollectionModel(model);
@@ -223,7 +224,7 @@ namespace Grand.Web.Admin.Controllers
{
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
- model.Stores = new string[] { _workContext.CurrentCustomer.StaffStoreId };
+ model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };
}
collection = await _collectionViewModelService.UpdateCollectionModel(collection, model);
Success(_translationService.GetResource("Admin.Catalog.Collections.Updated"));
@@ -356,7 +357,7 @@ namespace Grand.Web.Admin.Controllers
try
{
- if (importexcelfile != null && importexcelfile.Length > 0)
+ if (importexcelfile is { Length: > 0 })
{
await importManager.Import(importexcelfile.OpenReadStream());
}
diff --git a/src/Web/Grand.Web.Admin/Controllers/ContactAttributeController.cs b/src/Web/Grand.Web.Admin/Controllers/ContactAttributeController.cs
index 8beb175a1..ff00750d6 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ContactAttributeController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ContactAttributeController.cs
@@ -9,16 +9,16 @@ using Grand.Web.Common.DataSource;
using Grand.Web.Common.Filters;
using Grand.Web.Common.Security.Authorization;
using Grand.Domain.Catalog;
-using Grand.Web.Admin.Extensions;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Messages;
using Microsoft.AspNetCore.Mvc;
using Grand.Infrastructure;
+using Grand.Web.Admin.Extensions.Mapping;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.ContactAttributes)]
- public partial class ContactAttributeController : BaseAdminController
+ public class ContactAttributeController : BaseAdminController
{
#region Fields
private readonly IContactAttributeViewModelService _contactAttributeViewModelService;
@@ -189,12 +189,12 @@ namespace Grand.Web.Admin.Controllers
{
Id = x.Id,
ContactAttributeId = x.ContactAttributeId,
- Name = contactAttribute.AttributeControlType != AttributeControlType.ColorSquares ? x.Name : string.Format("{0} - {1}", x.Name, x.ColorSquaresRgb),
+ Name = contactAttribute.AttributeControlType != AttributeControlType.ColorSquares ? x.Name : $"{x.Name} - {x.ColorSquaresRgb}",
ColorSquaresRgb = x.ColorSquaresRgb,
IsPreSelected = x.IsPreSelected,
- DisplayOrder = x.DisplayOrder,
+ DisplayOrder = x.DisplayOrder
}),
- Total = values.Count()
+ Total = values.Count
};
return Json(gridModel);
}
@@ -223,7 +223,7 @@ namespace Grand.Web.Admin.Controllers
if (contactAttribute.AttributeControlType == AttributeControlType.ColorSquares)
{
//ensure valid color is chosen/entered
- if (String.IsNullOrEmpty(model.ColorSquaresRgb))
+ if (string.IsNullOrEmpty(model.ColorSquaresRgb))
ModelState.AddModelError("", "Color is required");
}
@@ -243,7 +243,7 @@ namespace Grand.Web.Admin.Controllers
public async Task<IActionResult> ValueEditPopup(string id, string contactAttributeId)
{
var contactAttribute = await _contactAttributeService.GetContactAttributeById(contactAttributeId);
- var cav = contactAttribute.ContactAttributeValues.Where(x => x.Id == id).FirstOrDefault();
+ var cav = contactAttribute.ContactAttributeValues.FirstOrDefault(x => x.Id == id);
if (cav == null)
//No contact attribute value found with the specified id
return RedirectToAction("List");
@@ -264,7 +264,7 @@ namespace Grand.Web.Admin.Controllers
{
var contactAttribute = await _contactAttributeService.GetContactAttributeById(model.ContactAttributeId);
- var cav = contactAttribute.ContactAttributeValues.Where(x => x.Id == model.Id).FirstOrDefault();
+ var cav = contactAttribute.ContactAttributeValues.FirstOrDefault(x => x.Id == model.Id);
if (cav == null)
//No contact attribute value found with the specified id
return RedirectToAction("List");
@@ -272,7 +272,7 @@ namespace Grand.Web.Admin.Controllers
if (contactAttribute.AttributeControlType == AttributeControlType.ColorSquares)
{
//ensure valid color is chosen/entered
- if (String.IsNullOrEmpty(model.ColorSquaresRgb))
+ if (string.IsNullOrEmpty(model.ColorSquaresRgb))
ModelState.AddModelError("", "Color is required");
}
@@ -293,7 +293,7 @@ namespace Grand.Web.Admin.Controllers
public async Task<IActionResult> ValueDelete(string id, string contactAttributeId)
{
var contactAttribute = await _contactAttributeService.GetContactAttributeById(contactAttributeId);
- var cav = contactAttribute.ContactAttributeValues.Where(x => x.Id == id).FirstOrDefault();
+ var cav = contactAttribute.ContactAttributeValues.FirstOrDefault(x => x.Id == id);
if (cav == null)
throw new ArgumentException("No contact attribute value found with the specified id");
if (ModelState.IsValid)
diff --git a/src/Web/Grand.Web.Admin/Controllers/ContactFormController.cs b/src/Web/Grand.Web.Admin/Controllers/ContactFormController.cs
index 80cd4884f..347a5e78f 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ContactFormController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ContactFormController.cs
@@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.MessageContactForm)]
- public partial class ContactFormController : BaseAdminController
+ public class ContactFormController : BaseAdminController
{
private readonly IContactUsService _contactUsService;
private readonly IContactFormViewModelService _contactFormViewModelService;
diff --git a/src/Web/Grand.Web.Admin/Controllers/CountryController.cs b/src/Web/Grand.Web.Admin/Controllers/CountryController.cs
index c9d5c2b9a..be403a9e8 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CountryController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CountryController.cs
@@ -4,7 +4,7 @@ using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Interfaces.ExportImport;
using Grand.Business.Core.Utilities.Common.Security;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Country;
using Grand.Web.Admin.Models.Directory;
@@ -17,7 +17,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Countries)]
- public partial class CountryController : BaseAdminController
+ public class CountryController : BaseAdminController
{
#region Fields
@@ -226,7 +226,12 @@ namespace Grand.Web.Admin.Controllers
var states = country.StateProvinces.ToList();
var gridModel = new DataSourceResult {
- Data = states.Select(x => new { Id = x.Id, Name = x.Name, Abbreviation = x.Abbreviation, Published = x.Published, DisplayOrder = x.DisplayOrder }),
+ Data = states.Select(x => new {
+ x.Id,
+ x.Name,
+ x.Abbreviation,
+ x.Published,
+ x.DisplayOrder }),
Total = states.Count
};
return Json(gridModel);
@@ -342,7 +347,7 @@ namespace Grand.Web.Admin.Controllers
var countries = await _countryService.GetAllCountries();
var query = from p in countries
from s in p.StateProvinces
- select new CountryStates() {
+ select new CountryStates {
Country = p.TwoLetterIsoCode,
StateProvinceName = s.Name,
Abbreviation = s.Abbreviation,
@@ -360,7 +365,7 @@ namespace Grand.Web.Admin.Controllers
{
try
{
- if (importexcelfile != null && importexcelfile.Length > 0)
+ if (importexcelfile is { Length: > 0 })
{
await _importManager.Import(importexcelfile.OpenReadStream());
diff --git a/src/Web/Grand.Web.Admin/Controllers/CourseController.cs b/src/Web/Grand.Web.Admin/Controllers/CourseController.cs
index 36729449c..2b4fdc7d1 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CourseController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CourseController.cs
@@ -12,6 +12,7 @@ using Grand.Web.Common.Security.Authorization;
using Grand.Domain.Courses;
using Grand.Infrastructure;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Courses;
using Microsoft.AspNetCore.Mvc;
@@ -19,7 +20,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Courses)]
- public partial class CourseController : BaseAdminController
+ public class CourseController : BaseAdminController
{
private readonly ITranslationService _translationService;
@@ -153,7 +154,7 @@ namespace Grand.Web.Admin.Controllers
{
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
- model.Stores = new string[] { _workContext.CurrentCustomer.StaffStoreId };
+ model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };
}
var course = await _courseViewModelService.InsertCourseModel(model);
@@ -223,7 +224,7 @@ namespace Grand.Web.Admin.Controllers
{
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
- model.Stores = new string[] { _workContext.CurrentCustomer.StaffStoreId };
+ model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };
}
course = await _courseViewModelService.UpdateCourseModel(course, model);
diff --git a/src/Web/Grand.Web.Admin/Controllers/CurrencyController.cs b/src/Web/Grand.Web.Admin/Controllers/CurrencyController.cs
index 6ec4f0ded..baf109d1d 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CurrencyController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CurrencyController.cs
@@ -7,7 +7,7 @@ using Grand.Business.Core.Utilities.Common.Security;
using Grand.Domain.Directory;
using Grand.Infrastructure.Caching;
using Grand.SharedKernel;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Directory;
using Grand.Web.Common.DataSource;
@@ -21,7 +21,7 @@ using System.Globalization;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Currencies)]
- public partial class CurrencyController : BaseAdminController
+ public class CurrencyController : BaseAdminController
{
#region Fields
diff --git a/src/Web/Grand.Web.Admin/Controllers/CustomerAttributeController.cs b/src/Web/Grand.Web.Admin/Controllers/CustomerAttributeController.cs
index 3168fbf63..14c4a0709 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CustomerAttributeController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CustomerAttributeController.cs
@@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Settings)]
- public partial class CustomerAttributeController : BaseAdminController
+ public class CustomerAttributeController : BaseAdminController
{
#region Fields
private readonly ICustomerAttributeService _customerAttributeService;
diff --git a/src/Web/Grand.Web.Admin/Controllers/CustomerController.cs b/src/Web/Grand.Web.Admin/Controllers/CustomerController.cs
index 3423c0738..cb30b2dbe 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CustomerController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CustomerController.cs
@@ -31,7 +31,7 @@ using Grand.Business.Core.Interfaces.ExportImport;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Customers)]
- public partial class CustomerController : BaseAdminController
+ public class CustomerController : BaseAdminController
{
#region Fields
@@ -113,7 +113,7 @@ namespace Grand.Web.Admin.Controllers
var customerAttributes = await _customerAttributeService.GetAllCustomerAttributes();
foreach (var attribute in customerAttributes)
{
- string controlId = string.Format("customer_attribute_{0}", attribute.Id);
+ var controlId = $"customer_attribute_{attribute.Id}";
switch (attribute.AttributeControlTypeId)
{
case AttributeControlType.DropdownList:
@@ -161,7 +161,7 @@ namespace Grand.Web.Admin.Controllers
form.TryGetValue(controlId, out var ctrlAttributes);
if (!string.IsNullOrEmpty(ctrlAttributes))
{
- string enteredText = ctrlAttributes.ToString().Trim();
+ var enteredText = ctrlAttributes.ToString().Trim();
customAttributes = _customerAttributeParser.AddCustomerAttribute(customAttributes,
attribute, enteredText).ToList();
}
@@ -182,8 +182,8 @@ namespace Grand.Web.Admin.Controllers
protected virtual async Task<bool> CheckSalesManager(Customer customer)
{
- return (await _groupService.IsSalesManager(_workContext.CurrentCustomer)
- && (_workContext.CurrentCustomer.SeId != customer.SeId));
+ return await _groupService.IsSalesManager(_workContext.CurrentCustomer)
+ && _workContext.CurrentCustomer.SeId != customer.SeId;
}
#region Customers
@@ -344,7 +344,7 @@ namespace Grand.Web.Admin.Controllers
if (custowner == null)
ModelState.AddModelError("", "Owner email is not exists");
- if (model.Owner.ToLower() == model.Email.ToLower())
+ if (string.Equals(model.Owner, model.Email, StringComparison.CurrentCultureIgnoreCase))
ModelState.AddModelError("", "You can't assign own email");
}
@@ -563,13 +563,13 @@ namespace Grand.Web.Admin.Controllers
try
{
- if (String.IsNullOrWhiteSpace(customer.Email))
+ if (string.IsNullOrWhiteSpace(customer.Email))
throw new GrandException("Customer email is empty");
if (!CommonHelper.IsValidEmail(customer.Email))
throw new GrandException("Customer email is not valid");
- if (String.IsNullOrWhiteSpace(model.SendEmail.Subject))
+ if (string.IsNullOrWhiteSpace(model.SendEmail.Subject))
throw new GrandException("Email subject is empty");
- if (String.IsNullOrWhiteSpace(model.SendEmail.Body))
+ if (string.IsNullOrWhiteSpace(model.SendEmail.Body))
throw new GrandException("Email body is empty");
await _customerViewModelService.SendEmail(customer, model.SendEmail);
@@ -711,7 +711,7 @@ namespace Grand.Web.Admin.Controllers
//No customer found with the specified id
return RedirectToAction("List");
- var address = customer.Addresses.Where(x => x.Id == addressId).FirstOrDefault();
+ var address = customer.Addresses.FirstOrDefault(x => x.Id == addressId);
if (address == null)
//No address found with the specified id
return RedirectToAction("Edit", new { id = customer.Id });
@@ -731,7 +731,7 @@ namespace Grand.Web.Admin.Controllers
//No customer found with the specified id
return RedirectToAction("List");
- var address = customer.Addresses.Where(x => x.Id == model.Address.Id).FirstOrDefault();
+ var address = customer.Addresses.FirstOrDefault(x => x.Id == model.Address.Id);
if (address == null)
//No address found with the specified id
return RedirectToAction("Edit", new { id = customer.Id });
@@ -852,7 +852,7 @@ namespace Grand.Web.Admin.Controllers
var gridModel = new DataSourceResult
{
Data = items,
- Total = productReviews.TotalCount,
+ Total = productReviews.TotalCount
};
return Json(gridModel);
}
@@ -1026,7 +1026,7 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> ContactFormList(DataSourceRequest command, string customerId)
{
- string vendorId = "";
+ var vendorId = "";
if (_workContext.CurrentVendor != null)
{
vendorId = _workContext.CurrentVendor.Id;
@@ -1141,7 +1141,7 @@ namespace Grand.Web.Admin.Controllers
try
{
- byte[] bytes = await _exportManager.Export(customers);
+ var bytes = await _exportManager.Export(customers);
return File(bytes, "text/xls", "customers.xlsx");
}
catch (Exception exc)
@@ -1165,7 +1165,7 @@ namespace Grand.Web.Admin.Controllers
customers.AddRange(await _customerService.GetCustomersByIds(ids));
}
- byte[] bytes = await _exportManager.Export(customers);
+ var bytes = await _exportManager.Export(customers);
return File(bytes, "text/xls", "customers.xlsx");
}
diff --git a/src/Web/Grand.Web.Admin/Controllers/CustomerGroupController.cs b/src/Web/Grand.Web.Admin/Controllers/CustomerGroupController.cs
index 026bdcd45..6b3448626 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CustomerGroupController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CustomerGroupController.cs
@@ -6,7 +6,7 @@ using Grand.Business.Core.Interfaces.Common.Security;
using Grand.Business.Core.Utilities.Common.Security;
using Grand.Infrastructure;
using Grand.SharedKernel;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Customers;
using Grand.Web.Common.DataSource;
@@ -17,7 +17,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.CustomerGroups)]
- public partial class CustomerGroupController : BaseAdminController
+ public class CustomerGroupController : BaseAdminController
{
#region Fields
@@ -68,7 +68,7 @@ namespace Grand.Web.Admin.Controllers
var rolesModel = x.ToModel();
return rolesModel;
}),
- Total = customerGroups.TotalCount,
+ Total = customerGroups.TotalCount
};
return Json(gridModel);
}
@@ -178,7 +178,7 @@ namespace Grand.Web.Admin.Controllers
var gridModel = new DataSourceResult
{
Data = products,
- Total = products.Count()
+ Total = products.Count
};
return Json(gridModel);
}
@@ -270,7 +270,7 @@ namespace Grand.Web.Admin.Controllers
var gridModel = new DataSourceResult
{
Data = model,
- Total = model.Count()
+ Total = model.Count
};
return Json(gridModel);
}
diff --git a/src/Web/Grand.Web.Admin/Controllers/CustomerTagController.cs b/src/Web/Grand.Web.Admin/Controllers/CustomerTagController.cs
index 63935a4a5..56e831622 100644
--- a/src/Web/Grand.Web.Admin/Controllers/CustomerTagController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/CustomerTagController.cs
@@ -2,7 +2,7 @@
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Utilities.Common.Security;
using Grand.Business.Core.Interfaces.Marketing.Customers;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Customers;
using Grand.Web.Common.DataSource;
@@ -13,7 +13,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.CustomerTags)]
- public partial class CustomerTagController : BaseAdminController
+ public class CustomerTagController : BaseAdminController
{
#region Fields
private readonly ICustomerTagViewModelService _customerTagViewModelService;
@@ -49,12 +49,12 @@ namespace Grand.Web.Admin.Controllers
var items = new List<(string Id, string Name, int Count)>();
foreach (var item in customertags)
{
- items.Add((Id: item.Id, Name: item.Name, Count: await _customerTagService.GetCustomerCount(item.Id)));
+ items.Add((item.Id, item.Name, Count: await _customerTagService.GetCustomerCount(item.Id)));
}
var gridModel = new DataSourceResult
{
- Data = items.Select(x => new { Id = x.Id, Name = x.Name, Count = x.Count }),
- Total = customertags.Count()
+ Data = items.Select(x => new { x.Id, x.Name, x.Count }),
+ Total = customertags.Count
};
return Json(gridModel);
}
@@ -205,7 +205,7 @@ namespace Grand.Web.Admin.Controllers
var gridModel = new DataSourceResult
{
Data = items,
- Total = products.Count()
+ Total = products.Count
};
return Json(gridModel);
}
diff --git a/src/Web/Grand.Web.Admin/Controllers/DiscountController.cs b/src/Web/Grand.Web.Admin/Controllers/DiscountController.cs
index a0d94d701..72b4f2a39 100644
--- a/src/Web/Grand.Web.Admin/Controllers/DiscountController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/DiscountController.cs
@@ -11,6 +11,7 @@ using Grand.Business.Core.Interfaces.Customers;
using Grand.Domain;
using Grand.Infrastructure;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Catalog;
using Grand.Web.Admin.Models.Discounts;
@@ -22,7 +23,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Discounts)]
- public partial class DiscountController : BaseAdminController
+ public class DiscountController : BaseAdminController
{
#region Fields
@@ -102,7 +103,7 @@ namespace Grand.Web.Admin.Controllers
{
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
- model.Stores = new string[] { _workContext.CurrentCustomer.StaffStoreId };
+ model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };
}
var discount = await _discountViewModelService.InsertDiscountModel(model);
@@ -160,7 +161,7 @@ namespace Grand.Web.Admin.Controllers
{
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
- model.Stores = new string[] { _workContext.CurrentCustomer.StaffStoreId };
+ model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };
}
discount = await _discountViewModelService.UpdateDiscountModel(discount, model);
Success(_translationService.GetResource("admin.marketing.discounts.Updated"));
@@ -226,9 +227,9 @@ namespace Grand.Web.Admin.Controllers
{
Data = couponcodes.Select(x => new
{
- Id = x.Id,
- CouponCode = x.CouponCode,
- Used = x.Used
+ x.Id,
+ x.CouponCode,
+ x.Used
}),
Total = couponcodes.TotalCount
};
@@ -250,7 +251,7 @@ namespace Grand.Web.Admin.Controllers
if (!coupon.Used)
await _discountService.DeleteDiscountCoupon(coupon);
else
- return new JsonResult(new DataSourceResult() { Errors = "You can't delete coupon code, it was used" });
+ return new JsonResult(new DataSourceResult { Errors = "You can't delete coupon code, it was used" });
return new JsonResult("");
}
@@ -269,8 +270,8 @@ namespace Grand.Web.Admin.Controllers
couponCode = couponCode.ToUpper();
- if ((await _discountService.GetDiscountByCouponCode(couponCode)) != null)
- return new JsonResult(new DataSourceResult() { Errors = "Coupon code exists" });
+ if (await _discountService.GetDiscountByCouponCode(couponCode) != null)
+ return new JsonResult(new DataSourceResult { Errors = "Coupon code exists" });
if (ModelState.IsValid)
{
await _discountViewModelService.InsertCouponCode(discountId, couponCode);
@@ -299,8 +300,8 @@ namespace Grand.Web.Admin.Controllers
throw new ArgumentException("Discount could not be loaded");
var singleRequirement = discountPlugin.GetRequirementRules().FirstOrDefault(x => x.SystemName.Equals(rulesystemName, StringComparison.OrdinalIgnoreCase));
- string url = _discountViewModelService.GetRequirementUrlInternal(singleRequirement, discount, discountRequirementId);
- return Json(new { url = url });
+ var url = _discountViewModelService.GetRequirementUrlInternal(singleRequirement, discount, discountRequirementId);
+ return Json(new { url });
}
[PermissionAuthorizeAction(PermissionActionName.Preview)]
@@ -319,10 +320,10 @@ namespace Grand.Web.Admin.Controllers
throw new ArgumentException("Discount requirement rule could not be loaded");
var discountRequirementRule = discountPlugin.GetRequirementRules().First(x => x.SystemName == discountRequirement.DiscountRequirementRuleSystemName);
- string url = _discountViewModelService.GetRequirementUrlInternal(discountRequirementRule, discount, discountRequirementId);
- string ruleName = discountRequirementRule.FriendlyName;
+ var url = _discountViewModelService.GetRequirementUrlInternal(discountRequirementRule, discount, discountRequirementId);
+ var ruleName = discountRequirementRule.FriendlyName;
- return Json(new { url = url, ruleName = ruleName });
+ return Json(new { url, ruleName });
}
[HttpPost]
@@ -742,7 +743,7 @@ namespace Grand.Web.Admin.Controllers
var vendors = await vendorService.GetAllVendors(model.SearchVendorName, command.Page - 1, command.PageSize, true);
//search for emails
- if (!(string.IsNullOrEmpty(model.SearchVendorEmail)))
+ if (!string.IsNullOrEmpty(model.SearchVendorEmail))
{
var tempVendors = vendors.Where(x => x.Email.ToLowerInvariant().Contains(model.SearchVendorEmail.Trim()));
vendors = new PagedList<Domain.Vendors.Vendor>(tempVendors, command.Page - 1, command.PageSize);
diff --git a/src/Web/Grand.Web.Admin/Controllers/DocumentController.cs b/src/Web/Grand.Web.Admin/Controllers/DocumentController.cs
index 262e428dd..2a60bca6f 100644
--- a/src/Web/Grand.Web.Admin/Controllers/DocumentController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/DocumentController.cs
@@ -4,7 +4,7 @@ using Grand.Business.Core.Utilities.Common.Security;
using Grand.Business.Core.Interfaces.Customers;
using Grand.Business.Core.Interfaces.Marketing.Documents;
using Grand.Infrastructure;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Documents;
using Grand.Web.Common.DataSource;
diff --git a/src/Web/Grand.Web.Admin/Controllers/DownloadController.cs b/src/Web/Grand.Web.Admin/Controllers/DownloadController.cs
index 7f25ad074..b50d0d3e6 100644
--- a/src/Web/Grand.Web.Admin/Controllers/DownloadController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/DownloadController.cs
@@ -10,7 +10,7 @@ using Grand.Web.Common.Extensions;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Files)]
- public partial class DownloadController : BaseAdminController
+ public class DownloadController : BaseAdminController
{
private readonly IDownloadService _downloadService;
private readonly IWorkContext _workContext;
@@ -31,10 +31,10 @@ namespace Grand.Web.Admin.Controllers
//use stored data
if (download.DownloadBinary == null)
- return Content(string.Format("Download data is not available any more. Download GD={0}", download.Id));
+ return Content($"Download data is not available any more. Download GD={download.Id}");
- string fileName = !String.IsNullOrWhiteSpace(download.Filename) ? download.Filename : download.Id.ToString();
- string contentType = !String.IsNullOrWhiteSpace(download.ContentType)
+ var fileName = !string.IsNullOrWhiteSpace(download.Filename) ? download.Filename : download.Id;
+ var contentType = !string.IsNullOrWhiteSpace(download.ContentType)
? download.ContentType
: "application/octet-stream";
return new FileContentResult(download.DownloadBinary, contentType) {
@@ -79,7 +79,7 @@ namespace Grand.Web.Admin.Controllers
{
success = false,
message = "No file uploaded",
- downloadGuid = Guid.Empty,
+ downloadGuid = Guid.Empty
});
}
diff --git a/src/Web/Grand.Web.Admin/Controllers/EmailAccountController.cs b/src/Web/Grand.Web.Admin/Controllers/EmailAccountController.cs
index 21a08d201..e13936fb0 100644
--- a/src/Web/Grand.Web.Admin/Controllers/EmailAccountController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/EmailAccountController.cs
@@ -5,7 +5,7 @@ using Grand.Business.Core.Interfaces.Messages;
using Grand.Domain.Messages;
using Grand.Infrastructure.Caching;
using Grand.SharedKernel;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Messages;
using Grand.Web.Common.DataSource;
@@ -16,7 +16,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.EmailAccounts)]
- public partial class EmailAccountController : BaseAdminController
+ public class EmailAccountController : BaseAdminController
{
private readonly IEmailAccountViewModelService _emailAccountViewModelService;
private readonly IEmailAccountService _emailAccountService;
@@ -52,7 +52,7 @@ namespace Grand.Web.Admin.Controllers
var gridModel = new DataSourceResult
{
Data = emailAccountModels,
- Total = emailAccountModels.Count()
+ Total = emailAccountModels.Count
};
return Json(gridModel);
@@ -133,7 +133,7 @@ namespace Grand.Web.Admin.Controllers
return RedirectToAction("List");
try
{
- if (String.IsNullOrWhiteSpace(model.SendTestEmailTo))
+ if (string.IsNullOrWhiteSpace(model.SendTestEmailTo))
throw new GrandException("Enter test email address");
if (ModelState.IsValid)
{
diff --git a/src/Web/Grand.Web.Admin/Controllers/ExternalAuthenticationController.cs b/src/Web/Grand.Web.Admin/Controllers/ExternalAuthenticationController.cs
index ef4db5b7f..f8bc9a6da 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ExternalAuthenticationController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ExternalAuthenticationController.cs
@@ -6,14 +6,14 @@ using Grand.Web.Common.DataSource;
using Grand.Web.Common.Security.Authorization;
using Grand.Domain.Customers;
using Grand.Infrastructure.Plugins;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Models.ExternalAuthentication;
using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.ExternalAuthenticationMethods)]
- public partial class ExternalAuthenticationController : BaseAdminController
+ public class ExternalAuthenticationController : BaseAdminController
{
#region Fields
diff --git a/src/Web/Grand.Web.Admin/Controllers/GiftVoucherController.cs b/src/Web/Grand.Web.Admin/Controllers/GiftVoucherController.cs
index 85a181f14..a18560f6c 100644
--- a/src/Web/Grand.Web.Admin/Controllers/GiftVoucherController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/GiftVoucherController.cs
@@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.GiftVouchers)]
- public partial class GiftVoucherController : BaseAdminController
+ public class GiftVoucherController : BaseAdminController
{
#region Fields
private readonly IGiftVoucherViewModelService _giftVoucherViewModelService;
diff --git a/src/Web/Grand.Web.Admin/Controllers/GoogleAnalyticsController.cs b/src/Web/Grand.Web.Admin/Controllers/GoogleAnalyticsController.cs
deleted file mode 100644
index a05ec43f8..000000000
--- a/src/Web/Grand.Web.Admin/Controllers/GoogleAnalyticsController.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-using Grand.Web.Admin.Interfaces;
-using Microsoft.AspNetCore.Mvc;
-
-
-namespace Grand.Web.Admin.Controllers
-{
- public partial class GoogleAnalyticsController : BaseAdminController
- {
- private readonly IGoogleAnalyticsViewModelService _googleAnalyticsService;
-
- public GoogleAnalyticsController(
- IGoogleAnalyticsViewModelService googleAnalyticsService)
- {
- _googleAnalyticsService = googleAnalyticsService;
- }
-
- public async Task<IActionResult> DashboardGeneralData(DateTime? startDate = null, DateTime? endDate = null)
- {
- if (!startDate.HasValue)
- {
- startDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
- }
- if (!endDate.HasValue)
- {
- endDate = DateTime.UtcNow;
- }
-
- var report = await _googleAnalyticsService.GetDataByGeneral(startDate.Value, endDate.Value);
- return PartialView(report);
- }
-
- public async Task<IActionResult> DashboardDataBySource(DateTime? startDate = null, DateTime? endDate = null)
- {
- if (!startDate.HasValue)
- {
- startDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
- }
- if (!endDate.HasValue)
- {
- endDate = DateTime.UtcNow;
- }
-
- var report = await _googleAnalyticsService.GetDataBySource(startDate.Value, endDate.Value);
- return PartialView(report);
- }
- public async Task<IActionResult> DashboardDataByDevice(DateTime? startDate = null, DateTime? endDate = null)
- {
- if (!startDate.HasValue)
- {
- startDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
- }
- if (!endDate.HasValue)
- {
- endDate = DateTime.UtcNow;
- }
-
- var report = await _googleAnalyticsService.GetDataByDevice(startDate.Value, endDate.Value);
- return PartialView(report);
- }
- public async Task<IActionResult> DashboardDataByLocalization(DateTime? startDate = null, DateTime? endDate = null)
- {
- if (!startDate.HasValue)
- {
- startDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
- }
- if (!endDate.HasValue)
- {
- endDate = DateTime.UtcNow;
- }
-
- var report = await _googleAnalyticsService.GetDataByLocalization(startDate.Value, endDate.Value);
- return PartialView(report);
- }
- public async Task<IActionResult> DashboardDataByExit(DateTime? startDate = null, DateTime? endDate = null)
- {
- if (!startDate.HasValue)
- {
- startDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
- }
- if (!endDate.HasValue)
- {
- endDate = DateTime.UtcNow;
- }
-
- var report = await _googleAnalyticsService.GetDataByExit(startDate.Value, endDate.Value);
- return PartialView(report);
- }
-
-
- }
-}
diff --git a/src/Web/Grand.Web.Admin/Controllers/HomeController.cs b/src/Web/Grand.Web.Admin/Controllers/HomeController.cs
index 5fcb3c644..fbc6b8fc6 100644
--- a/src/Web/Grand.Web.Admin/Controllers/HomeController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/HomeController.cs
@@ -10,7 +10,6 @@ using Grand.Business.Core.Interfaces.System.Reports;
using Grand.Domain.Customers;
using Grand.Domain.Directory;
using Grand.Domain.Orders;
-using Grand.Domain.Seo;
using Grand.Infrastructure;
using Grand.Web.Admin.Extensions;
using Grand.Web.Admin.Models.Home;
@@ -19,14 +18,13 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
- public partial class HomeController : BaseAdminController
+ public class HomeController : BaseAdminController
{
#region Fields
private readonly ITranslationService _translationService;
private readonly IStoreService _storeService;
private readonly IUserFieldService _userFieldService;
- private readonly GoogleAnalyticsSettings _googleAnalyticsSettings;
private readonly IWorkContext _workContext;
private readonly IGroupService _groupService;
private readonly IOrderReportService _orderReportService;
@@ -43,7 +41,6 @@ namespace Grand.Web.Admin.Controllers
ITranslationService translationService,
IStoreService storeService,
IUserFieldService userFieldService,
- GoogleAnalyticsSettings googleAnalyticsSettings,
IWorkContext workContext,
IGroupService groupService,
IOrderReportService orderReportService,
@@ -55,7 +52,6 @@ namespace Grand.Web.Admin.Controllers
_translationService = translationService;
_storeService = storeService;
_userFieldService = userFieldService;
- _googleAnalyticsSettings = googleAnalyticsSettings;
_workContext = workContext;
_groupService = groupService;
_orderReportService = orderReportService;
@@ -72,7 +68,7 @@ namespace Grand.Web.Admin.Controllers
private async Task<DashboardActivityModel> PrepareActivityModel()
{
var model = new DashboardActivityModel();
- string vendorId = "";
+ var vendorId = "";
if (_workContext.CurrentVendor != null)
vendorId = _workContext.CurrentVendor.Id;
@@ -81,16 +77,16 @@ namespace Grand.Web.Admin.Controllers
storeId = _workContext.CurrentCustomer.StaffStoreId;
model.OrdersPending = (await _orderReportService.GetOrderAverageReportLine(storeId: storeId, os: (int)OrderStatusSystem.Pending)).CountOrders;
- model.AbandonedCarts = (await _mediator.Send(new GetCustomerQuery() { StoreId = storeId, LoadOnlyWithShoppingCart = true })).Count();
+ model.AbandonedCarts = (await _mediator.Send(new GetCustomerQuery { StoreId = storeId, LoadOnlyWithShoppingCart = true })).Count();
var lowStockProducts = await _productsReportService.LowStockProducts(vendorId, storeId);
model.LowStockProducts = lowStockProducts.products.Count + lowStockProducts.combinations.Count;
- model.MerchandiseReturns = await _mediator.Send(new GetMerchandiseReturnCountQuery() { RequestStatusId = 0, StoreId = storeId });
+ model.MerchandiseReturns = await _mediator.Send(new GetMerchandiseReturnCountQuery { RequestStatusId = 0, StoreId = storeId });
model.TodayRegisteredCustomers =
- (await _mediator.Send(new GetCustomerQuery() {
+ (await _mediator.Send(new GetCustomerQuery {
StoreId = storeId,
- CustomerGroupIds = new string[] { (await _groupService.GetCustomerGroupBySystemName(SystemCustomerGroupNames.Registered)).Id },
+ CustomerGroupIds = new[] { (await _groupService.GetCustomerGroupBySystemName(SystemCustomerGroupNames.Registered)).Id },
CreatedFromUtc = DateTime.UtcNow.Date
})).Count();
return model;
@@ -106,11 +102,6 @@ namespace Grand.Web.Admin.Controllers
var model = new DashboardModel {
IsLoggedInAsVendor = _workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer)
};
- if (string.IsNullOrEmpty(_googleAnalyticsSettings.gaprivateKey) ||
- string.IsNullOrEmpty(_googleAnalyticsSettings.gaserviceAccountEmail) ||
- string.IsNullOrEmpty(_googleAnalyticsSettings.gaviewID))
- model.HideReportGA = true;
-
return View(model);
}
@@ -137,7 +128,7 @@ namespace Grand.Web.Admin.Controllers
}
//home page
- if (String.IsNullOrEmpty(returnUrl))
+ if (string.IsNullOrEmpty(returnUrl))
returnUrl = Url.Action("Index", "Home", new { area = Constants.AreaAdmin });
//prevent open redirection attack
if (!Url.IsLocalUrl(returnUrl))
@@ -175,8 +166,8 @@ namespace Grand.Web.Admin.Controllers
string countryId, bool? addSelectStateItem, bool? addAsterisk)
{
// This action method gets called via an ajax request
- if (String.IsNullOrEmpty(countryId))
- return Json(new List<dynamic>() { new { id = "", name = _translationService.GetResource("Address.SelectState") } });
+ if (string.IsNullOrEmpty(countryId))
+ return Json(new List<dynamic> { new { id = "", name = _translationService.GetResource("Address.SelectState") } });
var country = await countryService.GetCountryById(countryId);
var states = country != null ? country.StateProvinces.ToList() : new List<StateProvince>();
@@ -218,11 +209,12 @@ namespace Grand.Web.Admin.Controllers
var currentCustomer = _workContext.CurrentCustomer;
if (currentCustomer == null || await _groupService.IsGuest(currentCustomer))
{
- _ = _logger.Information(string.Format("Access denied to anonymous request on {0}", pageUrl));
+ _ = _logger.Information($"Access denied to anonymous request on {pageUrl}");
return View();
}
- _ = _logger.Information(string.Format("Access denied to user #{0} '{1}' on {2}", currentCustomer.Email, currentCustomer.Email, pageUrl));
+ _ = _logger.Information(
+ $"Access denied to user #{currentCustomer.Email} '{currentCustomer.Email}' on {pageUrl}");
return View();
diff --git a/src/Web/Grand.Web.Admin/Controllers/KnowledgebaseController.cs b/src/Web/Grand.Web.Admin/Controllers/KnowledgebaseController.cs
index 4cd82888b..77da9e2df 100644
--- a/src/Web/Grand.Web.Admin/Controllers/KnowledgebaseController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/KnowledgebaseController.cs
@@ -3,7 +3,6 @@ using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Interfaces.Common.Stores;
using Grand.Business.Core.Utilities.Common.Security;
-using Grand.Web.Admin.Extensions;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Knowledgebase;
using Grand.Web.Common.DataSource;
@@ -12,6 +11,7 @@ using Grand.Web.Common.Security.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Grand.Business.Core.Interfaces.Cms;
+using Grand.Web.Admin.Extensions.Mapping;
namespace Grand.Web.Admin.Controllers
{
@@ -284,7 +284,7 @@ namespace Grand.Web.Admin.Controllers
model.AvailableArticles.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
var articles = await _knowledgebaseService.GetKnowledgebaseArticles();
foreach (var a in articles)
- model.AvailableArticles.Add(new SelectListItem { Text = a.Name, Value = a.Id.ToString() });
+ model.AvailableArticles.Add(new SelectListItem { Text = a.Name, Value = a.Id });
return View(model);
}
diff --git a/src/Web/Grand.Web.Admin/Controllers/LanguageController.cs b/src/Web/Grand.Web.Admin/Controllers/LanguageController.cs
index 07a295cbb..6a7eb1cdd 100644
--- a/src/Web/Grand.Web.Admin/Controllers/LanguageController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/LanguageController.cs
@@ -4,7 +4,7 @@ using Grand.Web.Common.DataSource;
using Grand.Web.Common.Extensions;
using Grand.Web.Common.Filters;
using Grand.Web.Common.Security.Authorization;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Localization;
using Microsoft.AspNetCore.Http;
@@ -13,7 +13,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Languages)]
- public partial class LanguageController : BaseAdminController
+ public class LanguageController : BaseAdminController
{
#region Fields
@@ -52,7 +52,7 @@ namespace Grand.Web.Admin.Controllers
var gridModel = new DataSourceResult
{
Data = languages.Select(x => x.ToModel()),
- Total = languages.Count()
+ Total = languages.Count
};
return Json(gridModel);
}
@@ -279,13 +279,11 @@ namespace Grand.Web.Admin.Controllers
try
{
- if (importxmlfile != null && importxmlfile.Length > 0)
+ if (importxmlfile is { Length: > 0 })
{
- using (var sr = new StreamReader(importxmlfile.OpenReadStream(), Encoding.UTF8))
- {
- string content = sr.ReadToEnd();
- await _translationService.ImportResourcesFromXml(language, content);
- }
+ using var sr = new StreamReader(importxmlfile.OpenReadStream(), Encoding.UTF8);
+ var content = await sr.ReadToEndAsync();
+ await _translationService.ImportResourcesFromXml(language, content);
}
else
{
diff --git a/src/Web/Grand.Web.Admin/Controllers/LayoutController.cs b/src/Web/Grand.Web.Admin/Controllers/LayoutController.cs
index 278936e13..a36a0e19f 100644
--- a/src/Web/Grand.Web.Admin/Controllers/LayoutController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/LayoutController.cs
@@ -8,15 +8,15 @@ using Grand.Web.Common.Extensions;
using Grand.Web.Common.Security.Authorization;
using Grand.Domain.Catalog;
using Grand.Domain.Pages;
-using Grand.Web.Admin.Extensions;
using Grand.Web.Admin.Models.Layouts;
using Microsoft.AspNetCore.Mvc;
using Grand.Business.Core.Interfaces.Catalog.Brands;
+using Grand.Web.Admin.Extensions.Mapping.Layouts;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Maintenance)]
- public partial class LayoutController : BaseAdminController
+ public class LayoutController : BaseAdminController
{
#region Fields
@@ -175,7 +175,7 @@ namespace Grand.Web.Admin.Controllers
}
[HttpPost]
- public async Task<IActionResult> CollectionBrandDelete(string id)
+ public async Task<IActionResult> BrandLayoutDelete(string id)
{
var layout = await _brandLayoutService.GetBrandLayoutById(id);
if (layout == null)
diff --git a/src/Web/Grand.Web.Admin/Controllers/LoggerController.cs b/src/Web/Grand.Web.Admin/Controllers/LoggerController.cs
index 480453761..346809b6f 100644
--- a/src/Web/Grand.Web.Admin/Controllers/LoggerController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/LoggerController.cs
@@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.SystemLog)]
- public partial class LoggerController : BaseAdminController
+ public class LoggerController : BaseAdminController
{
private readonly ILogViewModelService _logViewModelService;
private readonly ILogger _logger;
diff --git a/src/Web/Grand.Web.Admin/Controllers/LoginController.cs b/src/Web/Grand.Web.Admin/Controllers/LoginController.cs
index f24dc6185..bfba91cff 100644
--- a/src/Web/Grand.Web.Admin/Controllers/LoginController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/LoginController.cs
@@ -4,7 +4,6 @@ using Grand.Business.Core.Events.Customers;
using Grand.Business.Core.Interfaces.Customers;
using Grand.Business.Core.Interfaces.Messages;
using Grand.Web.Common.Controllers;
-using Grand.Web.Common.Filters;
using Grand.Web.Common.Security.Captcha;
using Grand.Domain.Common;
using Grand.Domain.Customers;
@@ -55,9 +54,10 @@ namespace Grand.Web.Admin.Controllers
public IActionResult Index()
{
- var model = new LoginModel();
- model.UsernamesEnabled = _customerSettings.UsernamesEnabled;
- model.DisplayCaptcha = _captchaSettings.Enabled && _captchaSettings.ShowOnLoginPage;
+ var model = new LoginModel {
+ UsernamesEnabled = _customerSettings.UsernamesEnabled,
+ DisplayCaptcha = _captchaSettings.Enabled && _captchaSettings.ShowOnLoginPage
+ };
return View(model);
}
diff --git a/src/Web/Grand.Web.Admin/Controllers/MaintenanceController.cs b/src/Web/Grand.Web.Admin/Controllers/MaintenanceController.cs
index 0845c1c1f..6da9e6790 100644
--- a/src/Web/Grand.Web.Admin/Controllers/MaintenanceController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/MaintenanceController.cs
@@ -22,7 +22,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Maintenance)]
- public partial class MaintenanceController : BaseAdminController
+ public class MaintenanceController : BaseAdminController
{
#region Fields
@@ -65,11 +65,11 @@ namespace Grand.Web.Admin.Controllers
public IActionResult Maintenance()
{
- var model = new MaintenanceModel() {
- DeleteGuests = new MaintenanceModel.DeleteGuestsModel() {
+ var model = new MaintenanceModel {
+ DeleteGuests = new MaintenanceModel.DeleteGuestsModel {
EndDate = DateTime.UtcNow.AddDays(-7),
- OnlyWithoutShoppingCart = true,
- },
+ OnlyWithoutShoppingCart = true
+ }
};
@@ -94,11 +94,11 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> MaintenanceDeleteGuests(MaintenanceModel model)
{
- DateTime? startDateValue = (model.DeleteGuests.StartDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.DeleteGuests.StartDate.Value, _dateTimeService.CurrentTimeZone);
+ DateTime? startDateValue = model.DeleteGuests.StartDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.DeleteGuests.StartDate.Value, _dateTimeService.CurrentTimeZone);
- DateTime? endDateValue = (model.DeleteGuests.EndDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.DeleteGuests.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
+ DateTime? endDateValue = model.DeleteGuests.EndDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.DeleteGuests.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
TempData["NumberOfDeletedCustomers"] = await _customerService.DeleteGuestCustomers(startDateValue, endDateValue, model.DeleteGuests.OnlyWithoutShoppingCart);
@@ -193,8 +193,6 @@ namespace Grand.Web.Admin.Controllers
case 2:
active = false;
break;
- default:
- break;
}
var entityUrls = await _slugService.GetAllEntityUrl(model.SeName, active, command.Page - 1, command.PageSize);
var items = new List<UrlEntityModel>();
@@ -202,7 +200,7 @@ namespace Grand.Web.Admin.Controllers
{
//language
string languageName;
- if (String.IsNullOrEmpty(x.LanguageId))
+ if (string.IsNullOrEmpty(x.LanguageId))
{
languageName = _translationService.GetResource("admin.configuration.senames.Language.Standard");
}
@@ -213,7 +211,7 @@ namespace Grand.Web.Admin.Controllers
}
//details URL
- string detailsUrl = "";
+ var detailsUrl = "";
var entityName = x.EntityName != null ? x.EntityName.ToLowerInvariant() : "";
switch (entityName)
{
@@ -250,8 +248,6 @@ namespace Grand.Web.Admin.Controllers
case "knowledgebasearticle":
detailsUrl = Url.Action("EditArticle", "Knowledgebase", new { id = x.EntityId, area = Constants.AreaAdmin });
break;
- default:
- break;
}
items.Add(new UrlEntityModel {
@@ -368,7 +364,7 @@ namespace Grand.Web.Admin.Controllers
var robotsTxt = await _robotsTxtService.GetRobotsTxt(storeScope);
if (robotsTxt == null)
{
- await _robotsTxtService.InsertRobotsTxt(new Domain.Common.RobotsTxt() {
+ await _robotsTxtService.InsertRobotsTxt(new Domain.Common.RobotsTxt {
Name = model.Name,
Text = model.Text,
StoreId = storeScope
diff --git a/src/Web/Grand.Web.Admin/Controllers/MeasureController.cs b/src/Web/Grand.Web.Admin/Controllers/MeasureController.cs
index 61b70beca..285ea7b01 100644
--- a/src/Web/Grand.Web.Admin/Controllers/MeasureController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/MeasureController.cs
@@ -6,15 +6,15 @@ using Grand.Web.Common.Extensions;
using Grand.Web.Common.Security.Authorization;
using Grand.Domain.Directory;
using Grand.Infrastructure.Caching;
-using Grand.Web.Admin.Extensions;
using Grand.Web.Admin.Models.Directory;
using Microsoft.AspNetCore.Mvc;
using Grand.Business.Core.Interfaces.Catalog.Directory;
+using Grand.Web.Admin.Extensions.Mapping;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Measures)]
- public partial class MeasureController : BaseAdminController
+ public class MeasureController : BaseAdminController
{
#region Fields
diff --git a/src/Web/Grand.Web.Admin/Controllers/MerchandiseReturnController.cs b/src/Web/Grand.Web.Admin/Controllers/MerchandiseReturnController.cs
index 97d146781..05c4e10dc 100644
--- a/src/Web/Grand.Web.Admin/Controllers/MerchandiseReturnController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/MerchandiseReturnController.cs
@@ -18,7 +18,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.MerchandiseReturns)]
- public partial class MerchandiseReturnController : BaseAdminController
+ public class MerchandiseReturnController : BaseAdminController
{
#region Fields
@@ -74,7 +74,7 @@ namespace Grand.Web.Admin.Controllers
var gridModel = new DataSourceResult
{
Data = merchandiseReturnModels.merchandiseReturnModels,
- Total = merchandiseReturnModels.totalCount,
+ Total = merchandiseReturnModels.totalCount
};
return Json(gridModel);
@@ -119,7 +119,7 @@ namespace Grand.Web.Admin.Controllers
var gridModel = new DataSourceResult
{
Data = items,
- Total = items.Count,
+ Total = items.Count
};
return Json(gridModel);
diff --git a/src/Web/Grand.Web.Admin/Controllers/MessageTemplateController.cs b/src/Web/Grand.Web.Admin/Controllers/MessageTemplateController.cs
index 34048caea..a15078b7e 100644
--- a/src/Web/Grand.Web.Admin/Controllers/MessageTemplateController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/MessageTemplateController.cs
@@ -5,7 +5,7 @@ using Grand.Business.Core.Utilities.Common.Security;
using Grand.Business.Core.Interfaces.Messages;
using Grand.Business.Core.Interfaces.Storage;
using Grand.Domain.Messages;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Models.Messages;
using Grand.Web.Common.DataSource;
using Grand.Web.Common.Filters;
@@ -16,7 +16,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.MessageTemplates)]
- public partial class MessageTemplateController : BaseAdminController
+ public class MessageTemplateController : BaseAdminController
{
#region Fields
@@ -64,7 +64,7 @@ namespace Grand.Web.Admin.Controllers
//stores
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" });
foreach (var s in await _storeService.GetAllStores())
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
return View(model);
}
@@ -89,7 +89,7 @@ namespace Grand.Web.Admin.Controllers
.GetAllStores())
.Where(s => !x.LimitedToStores || templateModel.Stores.Contains(s.Id))
.ToList();
- for (int i = 0; i < stores.Count; i++)
+ for (var i = 0; i < stores.Count; i++)
{
templateModel.ListOfStores += stores[i].Shortcut;
if (i != stores.Count - 1)
@@ -109,10 +109,11 @@ namespace Grand.Web.Admin.Controllers
[PermissionAuthorizeAction(PermissionActionName.Create)]
public async Task<IActionResult> Create()
{
- var model = new MessageTemplateModel();
+ var model = new MessageTemplateModel {
+ //Stores
+ AllowedTokens = _messageTokenProvider.GetListOfAllowedTokens()
+ };
- //Stores
- model.AllowedTokens = _messageTokenProvider.GetListOfAllowedTokens();
//available email accounts
foreach (var ea in await _emailAccountService.GetAllEmailAccounts())
model.AvailableEmailAccounts.Add(ea.ToModel());
@@ -149,7 +150,7 @@ namespace Grand.Web.Admin.Controllers
//If we got this far, something failed, redisplay form
- model.HasAttachedDownload = !String.IsNullOrEmpty(model.AttachedDownloadId);
+ model.HasAttachedDownload = !string.IsNullOrEmpty(model.AttachedDownloadId);
model.AllowedTokens = _messageTokenProvider.GetListOfAllowedTokens();
//available email accounts
foreach (var ea in await _emailAccountService.GetAllEmailAccounts())
@@ -168,7 +169,7 @@ namespace Grand.Web.Admin.Controllers
var model = messageTemplate.ToModel();
model.SendImmediately = !model.DelayBeforeSend.HasValue;
- model.HasAttachedDownload = !String.IsNullOrEmpty(model.AttachedDownloadId);
+ model.HasAttachedDownload = !string.IsNullOrEmpty(model.AttachedDownloadId);
model.AllowedTokens = _messageTokenProvider.GetListOfAllowedTokens();
//available email accounts
foreach (var ea in await _emailAccountService.GetAllEmailAccounts())
@@ -182,7 +183,7 @@ namespace Grand.Web.Admin.Controllers
locale.Body = messageTemplate.GetTranslation(x => x.Body, languageId, false);
var emailAccountId = messageTemplate.GetTranslation(x => x.EmailAccountId, languageId, false);
- locale.EmailAccountId = !String.IsNullOrEmpty(emailAccountId) ? emailAccountId : _emailAccountSettings.DefaultEmailAccountId;
+ locale.EmailAccountId = !string.IsNullOrEmpty(emailAccountId) ? emailAccountId : _emailAccountSettings.DefaultEmailAccountId;
});
return View(model);
@@ -231,7 +232,7 @@ namespace Grand.Web.Admin.Controllers
}
//If we got this far, something failed, redisplay form
- model.HasAttachedDownload = !String.IsNullOrEmpty(model.AttachedDownloadId);
+ model.HasAttachedDownload = !string.IsNullOrEmpty(model.AttachedDownloadId);
model.AllowedTokens = _messageTokenProvider.GetListOfAllowedTokens();
//available email accounts
foreach (var ea in await _emailAccountService.GetAllEmailAccounts())
diff --git a/src/Web/Grand.Web.Admin/Controllers/NewsController.cs b/src/Web/Grand.Web.Admin/Controllers/NewsController.cs
index 59fff4178..db8310414 100644
--- a/src/Web/Grand.Web.Admin/Controllers/NewsController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/NewsController.cs
@@ -8,7 +8,7 @@ using Grand.Web.Common.DataSource;
using Grand.Web.Common.Filters;
using Grand.Web.Common.Security.Authorization;
using Grand.Domain.News;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.News;
using Microsoft.AspNetCore.Mvc;
@@ -17,7 +17,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.News)]
- public partial class NewsController : BaseAdminController
+ public class NewsController : BaseAdminController
{
#region Fields
private readonly INewsViewModelService _newsViewModelService;
@@ -61,7 +61,7 @@ namespace Grand.Web.Admin.Controllers
//stores
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" });
foreach (var s in await _storeService.GetAllStores())
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
return View(model);
}
@@ -83,11 +83,12 @@ namespace Grand.Web.Admin.Controllers
public async Task<IActionResult> Create()
{
ViewBag.AllLanguages = _languageService.GetAllLanguages(true);
- var model = new NewsItemModel();
+ var model = new NewsItemModel {
+ //default values
+ Published = true,
+ AllowComments = true
+ };
- //default values
- model.Published = true;
- model.AllowComments = true;
//locales
await AddLocales(_languageService, model.Locales);
return View(model);
@@ -201,7 +202,7 @@ namespace Grand.Web.Admin.Controllers
var gridModel = new DataSourceResult
{
Data = comments.newsCommentModels.ToList(),
- Total = comments.totalCount,
+ Total = comments.totalCount
};
return Json(gridModel);
}
diff --git a/src/Web/Grand.Web.Admin/Controllers/NewsLetterCategoryController.cs b/src/Web/Grand.Web.Admin/Controllers/NewsLetterCategoryController.cs
index fa85815fb..f8a836ad0 100644
--- a/src/Web/Grand.Web.Admin/Controllers/NewsLetterCategoryController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/NewsLetterCategoryController.cs
@@ -2,7 +2,7 @@
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Utilities.Common.Security;
using Grand.Business.Core.Interfaces.Marketing.Newsletters;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Models.Messages;
using Grand.Web.Common.DataSource;
using Grand.Web.Common.Filters;
@@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.NewsletterCategories)]
- public partial class NewsletterCategoryController : BaseAdminController
+ public class NewsletterCategoryController : BaseAdminController
{
#region Fields
@@ -53,10 +53,10 @@ namespace Grand.Web.Admin.Controllers
{
return new
{
- Id = x.Id,
- Name = x.Name,
- Selected = x.Selected,
- DisplayOrder = x.DisplayOrder
+ x.Id,
+ x.Name,
+ x.Selected,
+ x.DisplayOrder
};
}).OrderBy(x => x.DisplayOrder),
Total = newslettercategories.Count
diff --git a/src/Web/Grand.Web.Admin/Controllers/NewsLetterSubscriptionController.cs b/src/Web/Grand.Web.Admin/Controllers/NewsLetterSubscriptionController.cs
index 9d3f92a1a..b28b0066b 100644
--- a/src/Web/Grand.Web.Admin/Controllers/NewsLetterSubscriptionController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/NewsLetterSubscriptionController.cs
@@ -5,7 +5,7 @@ using Grand.Business.Core.Interfaces.Marketing.Newsletters;
using Grand.Business.Core.Utilities.Common.Security;
using Grand.Infrastructure;
using Grand.SharedKernel.Extensions;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Models.Messages;
using Grand.Web.Common.DataSource;
using Grand.Web.Common.Extensions;
@@ -17,7 +17,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.NewsletterSubscribers)]
- public partial class NewsLetterSubscriptionController : BaseAdminController
+ public class NewsLetterSubscriptionController : BaseAdminController
{
private readonly INewsLetterSubscriptionService _newsLetterSubscriptionService;
private readonly INewsletterCategoryService _newsletterCategoryService;
@@ -48,7 +48,7 @@ namespace Grand.Web.Admin.Controllers
protected virtual async Task<string> GetCategoryNames(IList<string> categoryNames, string separator = ",")
{
var sb = new StringBuilder();
- for (int i = 0; i < categoryNames.Count; i++)
+ for (var i = 0; i < categoryNames.Count; i++)
{
var category = await _newsletterCategoryService.GetNewsletterCategoryById(categoryNames[i]);
if (category != null)
@@ -76,7 +76,7 @@ namespace Grand.Web.Admin.Controllers
//stores
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var s in (await _storeService.GetAllStores()).Where(x => x.Id == storeId || string.IsNullOrWhiteSpace(storeId)))
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
//active
model.ActiveList.Add(new SelectListItem {
@@ -93,7 +93,7 @@ namespace Grand.Web.Admin.Controllers
});
foreach (var ca in await _newsletterCategoryService.GetAllNewsletterCategory())
- model.AvailableCategories.Add(new SelectListItem { Text = ca.Name, Value = ca.Id.ToString() });
+ model.AvailableCategories.Add(new SelectListItem { Text = ca.Name, Value = ca.Id });
return View(model);
}
@@ -180,9 +180,10 @@ namespace Grand.Web.Admin.Controllers
var subscriptions = await _newsLetterSubscriptionService.GetAllNewsLetterSubscriptions(model.SearchEmail,
model.StoreId, isActive, searchCategoryIds);
- string result = _newsLetterSubscriptionService.ExportNewsletterSubscribersToTxt(subscriptions);
+ var result = _newsLetterSubscriptionService.ExportNewsletterSubscribersToTxt(subscriptions);
- string fileName = String.Format("newsletter_emails_{0}_{1}.txt", DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss"), CommonHelper.GenerateRandomDigitCode(4));
+ var fileName =
+ $"newsletter_emails_{DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss")}_{CommonHelper.GenerateRandomDigitCode(4)}.txt";
return File(Encoding.UTF8.GetBytes(result), "text/csv", fileName);
}
@@ -192,7 +193,7 @@ namespace Grand.Web.Admin.Controllers
{
try
{
- if (importcsvfile != null && importcsvfile.Length > 0)
+ if (importcsvfile is { Length: > 0 })
{
var count = await _newsLetterSubscriptionService.ImportNewsletterSubscribersFromTxt(importcsvfile.OpenReadStream(), _workContext.CurrentStore.Id);
Success(string.Format(_translationService.GetResource("admin.marketing.NewsLetterSubscriptions.ImportEmailsSuccess"), count));
diff --git a/src/Web/Grand.Web.Admin/Controllers/OnlineCustomerController.cs b/src/Web/Grand.Web.Admin/Controllers/OnlineCustomerController.cs
index 7930b14f5..c8f7cf175 100644
--- a/src/Web/Grand.Web.Admin/Controllers/OnlineCustomerController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/OnlineCustomerController.cs
@@ -14,7 +14,7 @@ using Grand.Business.Core.Interfaces.Catalog.Directory;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Customers)]
- public partial class OnlineCustomerController : BaseAdminController
+ public class OnlineCustomerController : BaseAdminController
{
#region Fields
@@ -57,7 +57,7 @@ namespace Grand.Web.Admin.Controllers
var items = new List<OnlineCustomerModel>();
foreach (var x in customers)
{
- var item = new OnlineCustomerModel() {
+ var item = new OnlineCustomerModel {
Id = x.Id,
CustomerInfo = !string.IsNullOrEmpty(x.Email) ? x.Email : _translationService.GetResource("Admin.Customers.Guest"),
LastIpAddress = x.LastIpAddress,
diff --git a/src/Web/Grand.Web.Admin/Controllers/OrderController.cs b/src/Web/Grand.Web.Admin/Controllers/OrderController.cs
index e58fd979e..4515a6836 100644
--- a/src/Web/Grand.Web.Admin/Controllers/OrderController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/OrderController.cs
@@ -25,7 +25,7 @@ using Grand.Business.Core.Interfaces.ExportImport;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Orders)]
- public partial class OrderController : BaseAdminController
+ public class OrderController : BaseAdminController
{
#region Fields
@@ -71,8 +71,8 @@ namespace Grand.Web.Admin.Controllers
protected virtual async Task<bool> CheckSalesManager(Order order)
{
- return (await _groupService.IsSalesManager(_workContext.CurrentCustomer)
- && (_workContext.CurrentCustomer.SeId != order.SeId));
+ return await _groupService.IsSalesManager(_workContext.CurrentCustomer)
+ && _workContext.CurrentCustomer.SeId != order.SeId;
}
#endregion
@@ -98,7 +98,7 @@ namespace Grand.Web.Admin.Controllers
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
storeId = _workContext.CurrentCustomer.StaffStoreId;
- string vendorId = string.Empty;
+ var vendorId = string.Empty;
//a vendor should have access only to his products
if (_workContext.CurrentVendor != null)
{
@@ -199,7 +199,7 @@ namespace Grand.Web.Admin.Controllers
var orders = await _orderViewModelService.PrepareOrders(model);
try
{
- byte[] bytes = await _exportManager.Export(orders);
+ var bytes = await _exportManager.Export(orders);
return File(bytes, "text/xls", "orders.xlsx");
}
catch (Exception exc)
@@ -230,7 +230,7 @@ namespace Grand.Web.Admin.Controllers
{
orders = orders.Where(x => x.StoreId == _workContext.CurrentCustomer.StaffStoreId).ToList();
}
- byte[] bytes = await _exportManager.Export(orders);
+ var bytes = await _exportManager.Export(orders);
return File(bytes, "text/xls", "orders.xlsx");
}
@@ -259,7 +259,7 @@ namespace Grand.Web.Admin.Controllers
}
try
{
- await _mediator.Send(new CancelOrderCommand() { Order = order, NotifyCustomer = true });
+ await _mediator.Send(new CancelOrderCommand { Order = order, NotifyCustomer = true });
_ = _orderViewModelService.LogEditOrder(order.Id);
@@ -269,7 +269,7 @@ namespace Grand.Web.Admin.Controllers
catch (Exception exc)
{
//error
- Error(exc, true);
+ Error(exc);
return RedirectToAction("Edit", "Order", new { id });
}
}
@@ -343,7 +343,7 @@ namespace Grand.Web.Admin.Controllers
Note = $"Order status has been edited. New status: {status?.Name}",
DisplayToCustomer = false,
CreatedOnUtc = DateTime.UtcNow,
- OrderId = order.Id,
+ OrderId = order.Id
});
_ = _orderViewModelService.LogEditOrder(order.Id);
@@ -403,13 +403,13 @@ namespace Grand.Web.Admin.Controllers
if (_workContext.CurrentVendor != null || await _groupService.IsStaff(_workContext.CurrentCustomer))
return RedirectToAction("Edit", "Order", new { id });
- var shipments = (await shipmentService.GetShipmentsByOrder(order.Id));
+ var shipments = await shipmentService.GetShipmentsByOrder(order.Id);
if (shipments.Any())
ModelState.AddModelError("", "This order is in associated with shipment. Please delete it first.");
if (ModelState.IsValid)
{
- await _mediator.Send(new DeleteOrderCommand() { Order = order });
+ await _mediator.Send(new DeleteOrderCommand { Order = order });
_ = customerActivityService.InsertActivity("DeleteOrder", id,
_workContext.CurrentCustomer, HttpContext.Connection?.RemoteIpAddress?.ToString(),
_translationService.GetResource("ActivityLog.DeleteOrder"), order.Id);
@@ -436,13 +436,13 @@ namespace Grand.Web.Admin.Controllers
for (var i = 0; i < orders.Count; i++)
{
var order = orders[i];
- var shipments = (await shipmentService.GetShipmentsByOrder(order.Id));
+ var shipments = await shipmentService.GetShipmentsByOrder(order.Id);
if (shipments.Any())
Error("Some orders is in associated with shipments. Please delete it first.");
if (!shipments.Any())
{
- await _mediator.Send(new DeleteOrderCommand() { Order = order });
+ await _mediator.Send(new DeleteOrderCommand { Order = order });
_ = customerActivityService.InsertActivity("DeleteOrder", order.Id,
_workContext.CurrentCustomer, HttpContext.Connection?.RemoteIpAddress?.ToString(),
_translationService.GetResource("ActivityLog.DeleteOrder"), order.Id);
@@ -479,7 +479,7 @@ namespace Grand.Web.Admin.Controllers
await _pdfService.PrintOrdersToPdf(stream, orders, _workContext.WorkingLanguage.Id, vendorId);
bytes = stream.ToArray();
}
- return File(bytes, "application/pdf", string.Format("order_{0}.pdf", order.Id));
+ return File(bytes, "application/pdf", $"order_{order.Id}.pdf");
}
[PermissionAuthorizeAction(PermissionActionName.Export)]
@@ -586,7 +586,7 @@ namespace Grand.Web.Admin.Controllers
Note = "Order totals have been edited",
DisplayToCustomer = false,
CreatedOnUtc = DateTime.UtcNow,
- OrderId = order.Id,
+ OrderId = order.Id
});
_ = _orderViewModelService.LogEditOrder(order.Id);
@@ -620,7 +620,7 @@ namespace Grand.Web.Admin.Controllers
Note = "Shipping method has been edited",
DisplayToCustomer = false,
CreatedOnUtc = DateTime.UtcNow,
- OrderId = order.Id,
+ OrderId = order.Id
});
_ = _orderViewModelService.LogEditOrder(order.Id);
await _orderViewModelService.PrepareOrderDetailsModel(model, order);
@@ -685,7 +685,7 @@ namespace Grand.Web.Admin.Controllers
}
//get order item identifier
- string orderItemId = "";
+ var orderItemId = "";
foreach (var formValue in form.Keys)
if (formValue.StartsWith("btnSaveOrderItem", StringComparison.OrdinalIgnoreCase))
orderItemId = formValue["btnSaveOrderItem".Length..];
@@ -694,9 +694,9 @@ namespace Grand.Web.Admin.Controllers
if (orderItem == null)
throw new ArgumentException("No order item found with the specified id");
- if (!double.TryParse(form["pvUnitPriceExclTax" + orderItemId], out double unitPriceExclTax))
+ if (!double.TryParse(form["pvUnitPriceExclTax" + orderItemId], out var unitPriceExclTax))
unitPriceExclTax = orderItem.UnitPriceExclTax;
- if (!int.TryParse(form["pvQuantity" + orderItemId], out int quantity))
+ if (!int.TryParse(form["pvQuantity" + orderItemId], out var quantity))
quantity = orderItem.Quantity;
if (quantity == 0 || (orderItem.OpenQty != orderItem.Quantity && orderItem.IsShipEnabled))
@@ -717,7 +717,7 @@ namespace Grand.Web.Admin.Controllers
if (orderItem.UnitPriceExclTax != unitPriceExclTax)
{
orderItem.UnitPriceExclTax = unitPriceExclTax;
- orderItem.UnitPriceInclTax = Math.Round((orderItem.UnitPriceExclTax * orderItem.TaxRate / 100) + orderItem.UnitPriceExclTax, 2);
+ orderItem.UnitPriceInclTax = Math.Round(orderItem.UnitPriceExclTax * orderItem.TaxRate / 100 + orderItem.UnitPriceExclTax, 2);
orderItem.PriceInclTax = Math.Round(orderItem.UnitPriceInclTax * orderItem.Quantity, 2);
orderItem.PriceExclTax = Math.Round(orderItem.UnitPriceExclTax * orderItem.Quantity, 2);
@@ -733,7 +733,7 @@ namespace Grand.Web.Admin.Controllers
orderItem.DiscountAmountExclTax = 0;
}
- await _mediator.Send(new UpdateOrderItemCommand() { Order = order, OrderItem = orderItem });
+ await _mediator.Send(new UpdateOrderItemCommand { Order = order, OrderItem = orderItem });
//selected tab
await SaveSelectedTabIndex(persistForTheNextRequest: true);
@@ -759,7 +759,7 @@ namespace Grand.Web.Admin.Controllers
return RedirectToAction("Edit", "Order", new { id });
}
//get order item identifier
- string orderItemId = "";
+ var orderItemId = "";
foreach (var formValue in form.Keys)
if (formValue.StartsWith("btnDeleteOrderItem", StringComparison.OrdinalIgnoreCase))
orderItemId = formValue["btnDeleteOrderItem".Length..];
@@ -768,7 +768,7 @@ namespace Grand.Web.Admin.Controllers
if (orderItem == null)
throw new ArgumentException("No order item found with the specified id");
- var result = await _mediator.Send(new DeleteOrderItemCommand() { Order = order, OrderItem = orderItem });
+ var result = await _mediator.Send(new DeleteOrderItemCommand { Order = order, OrderItem = orderItem });
if (result.error)
Error(result.message);
@@ -797,7 +797,7 @@ namespace Grand.Web.Admin.Controllers
return RedirectToAction("Edit", "Order", new { id });
}
//get order item identifier
- string orderItemId = "";
+ var orderItemId = "";
foreach (var formValue in form.Keys)
if (formValue.StartsWith("btnCancelOrderItem", StringComparison.OrdinalIgnoreCase))
orderItemId = formValue["btnCancelOrderItem".Length..];
@@ -807,11 +807,11 @@ namespace Grand.Web.Admin.Controllers
throw new ArgumentException("No order item found with the specified id");
- var result = await _mediator.Send(new CancelOrderItemCommand() { Order = order, OrderItem = orderItem });
+ var result = await _mediator.Send(new CancelOrderItemCommand { Order = order, OrderItem = orderItem });
if (result.error)
Error(result.message);
else
- Success("The order item was successfully canceled", true);
+ Success("The order item was successfully canceled");
//selected tab
await SaveSelectedTabIndex(persistForTheNextRequest: true);
@@ -834,7 +834,7 @@ namespace Grand.Web.Admin.Controllers
}
//get order item identifier
- string orderItemId = "";
+ var orderItemId = "";
foreach (var formValue in form.Keys)
if (formValue.StartsWith("btnResetDownloadCount", StringComparison.OrdinalIgnoreCase))
orderItemId = formValue["btnResetDownloadCount".Length..];
@@ -875,7 +875,7 @@ namespace Grand.Web.Admin.Controllers
}
//get order item identifier
- string orderItemId = "";
+ var orderItemId = "";
foreach (var formValue in form.Keys)
if (formValue.StartsWith("btnPvActivateDownload", StringComparison.OrdinalIgnoreCase))
orderItemId = formValue["btnPvActivateDownload".Length..];
@@ -928,7 +928,7 @@ namespace Grand.Web.Admin.Controllers
var model = new OrderModel.UploadLicenseModel
{
- LicenseDownloadId = !String.IsNullOrEmpty(orderItem.LicenseDownloadId) ? orderItem.LicenseDownloadId : "",
+ LicenseDownloadId = !string.IsNullOrEmpty(orderItem.LicenseDownloadId) ? orderItem.LicenseDownloadId : "",
OrderId = order.Id,
OrderItemId = orderItem.Id
};
@@ -1056,7 +1056,7 @@ namespace Grand.Web.Admin.Controllers
{
Id = x.Id,
Name = x.Name,
- Sku = x.Sku,
+ Sku = x.Sku
};
return productModel;
@@ -1077,9 +1077,6 @@ namespace Grand.Web.Admin.Controllers
if (order == null || await CheckSalesManager(order))
return RedirectToAction("List");
- if (order == null)
- return RedirectToAction("List");
-
if (await _groupService.IsStaff(_workContext.CurrentCustomer) && order.StoreId != _workContext.CurrentCustomer.StaffStoreId)
{
return RedirectToAction("List");
@@ -1198,7 +1195,7 @@ namespace Grand.Web.Admin.Controllers
if (ModelState.IsValid)
{
await _orderViewModelService.UpdateOrderAddress(order, address, model, customAttributes);
- return RedirectToAction("AddressEdit", new { addressId = model.Address.Id, orderId = model.OrderId, BillingAddress = model.BillingAddress });
+ return RedirectToAction("AddressEdit", new { addressId = model.Address.Id, orderId = model.OrderId, model.BillingAddress });
}
//If we got this far, something failed, redisplay form
diff --git a/src/Web/Grand.Web.Admin/Controllers/OrderStatusController.cs b/src/Web/Grand.Web.Admin/Controllers/OrderStatusController.cs
index 8933aa3e3..eae1c2dbd 100644
--- a/src/Web/Grand.Web.Admin/Controllers/OrderStatusController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/OrderStatusController.cs
@@ -1,7 +1,7 @@
using Grand.Business.Core.Interfaces.Checkout.Orders;
using Grand.Business.Core.Utilities.Common.Security;
using Grand.Domain.Orders;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Models.Orders;
using Grand.Web.Common.DataSource;
using Grand.Web.Common.Extensions;
@@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.OrderStatus)]
- public partial class OrderStatusController : BaseAdminController
+ public class OrderStatusController : BaseAdminController
{
#region Fields
diff --git a/src/Web/Grand.Web.Admin/Controllers/OrderTagsController.cs b/src/Web/Grand.Web.Admin/Controllers/OrderTagsController.cs
index c4dbbdd4d..d186ddd74 100644
--- a/src/Web/Grand.Web.Admin/Controllers/OrderTagsController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/OrderTagsController.cs
@@ -37,21 +37,22 @@ namespace Grand.Web.Admin.Controllers
[PermissionAuthorizeAction(PermissionActionName.List)]
public async Task<IActionResult> List(DataSourceRequest command)
{
- var tags = (await _orderTagService.GetAllOrderTags());
+ var tags = await _orderTagService.GetAllOrderTags();
var orderTagsList = new List<OrderTagModel>();
foreach (var tag in tags)
{
- var item = new OrderTagModel();
- item.Id = tag.Id;
- item.Name = tag.Name;
- item.OrderCount = await _orderTagService.GetOrderCount(tag.Id, "");
+ var item = new OrderTagModel {
+ Id = tag.Id,
+ Name = tag.Name,
+ OrderCount = await _orderTagService.GetOrderCount(tag.Id, "")
+ };
orderTagsList.Add(item);
}
var gridModel = new DataSourceResult
{
Data = orderTagsList.OrderByDescending(x => x.OrderCount).PagedForCommand(command),
- Total = tags.Count()
+ Total = tags.Count
};
return Json(gridModel);
@@ -77,8 +78,7 @@ namespace Grand.Web.Admin.Controllers
{
Data = orders.Select(x => new
{
- Id = x.Id,
- OrderNumber = x.OrderNumber
+ x.Id, x.OrderNumber
}),
Total = orders.Count
};
diff --git a/src/Web/Grand.Web.Admin/Controllers/PageController.cs b/src/Web/Grand.Web.Admin/Controllers/PageController.cs
index d65bb039c..1cdca85b8 100644
--- a/src/Web/Grand.Web.Admin/Controllers/PageController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/PageController.cs
@@ -7,7 +7,7 @@ using Grand.Infrastructure;
using Grand.Web.Common.DataSource;
using Grand.Web.Common.Filters;
using Grand.Web.Common.Security.Authorization;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Pages;
using Microsoft.AspNetCore.Mvc;
@@ -15,7 +15,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Pages)]
- public partial class PageController : BaseAdminController
+ public class PageController : BaseAdminController
{
#region Fields
diff --git a/src/Web/Grand.Web.Admin/Controllers/PaymentController.cs b/src/Web/Grand.Web.Admin/Controllers/PaymentController.cs
index 252375f9c..d10920eb0 100644
--- a/src/Web/Grand.Web.Admin/Controllers/PaymentController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/PaymentController.cs
@@ -10,6 +10,8 @@ using Grand.Domain.Payments;
using Grand.Infrastructure;
using Grand.Infrastructure.Plugins;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
+using Grand.Web.Admin.Extensions.Mapping.Settings;
using Grand.Web.Admin.Models.Payments;
using Grand.Web.Common.DataSource;
using Grand.Web.Common.Security.Authorization;
@@ -19,7 +21,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.PaymentMethods)]
- public partial class PaymentController : BaseAdminController
+ public class PaymentController : BaseAdminController
{
#region Fields
@@ -154,7 +156,7 @@ namespace Grand.Web.Admin.Controllers
}
foreach (var s in shippings)
{
- model.AvailableShippingMethods.Add(new Models.Shipping.ShippingMethodModel() {
+ model.AvailableShippingMethods.Add(new Models.Shipping.ShippingMethodModel {
Id = s.Id,
Name = s.Name
});
@@ -165,7 +167,7 @@ namespace Grand.Web.Admin.Controllers
var restictedCountries = _paymentService.GetRestrictedCountryIds(pm);
foreach (var c in countries)
{
- bool resticted = restictedCountries.Contains(c.Id);
+ var resticted = restictedCountries.Contains(c.Id);
if (!model.Resticted.ContainsKey(pm.SystemName))
model.Resticted[pm.SystemName] = new Dictionary<string, bool>();
model.Resticted[pm.SystemName][c.Id] = resticted;
@@ -174,7 +176,7 @@ namespace Grand.Web.Admin.Controllers
var restictedShipping = _paymentService.GetRestrictedShippingIds(pm);
foreach (var s in shippings)
{
- bool resticted = restictedShipping.Contains(s.Name);
+ var resticted = restictedShipping.Contains(s.Name);
if (!model.RestictedShipping.ContainsKey(pm.SystemName))
model.RestictedShipping[pm.SystemName] = new Dictionary<string, bool>();
model.RestictedShipping[pm.SystemName][s.Name] = resticted;
@@ -195,8 +197,8 @@ namespace Grand.Web.Admin.Controllers
foreach (var pm in paymentMethods)
{
- string formKey = "restrict_" + pm.SystemName;
- var countryIdsToRestrict = (form[formKey].ToString() != null ? form[formKey].ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList() : new List<string>())
+ var formKey = "restrict_" + pm.SystemName;
+ var countryIdsToRestrict = form[formKey].ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList()
.Select(x => x).ToList();
var newCountryIds = new List<string>();
@@ -210,7 +212,7 @@ namespace Grand.Web.Admin.Controllers
await _paymentService.SaveRestrictedCountryIds(pm, newCountryIds);
formKey = "restrictship_" + pm.SystemName;
- var shipIdsToRestrict = (form[formKey].ToString() != null ? form[formKey].ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList() : new List<string>())
+ var shipIdsToRestrict = form[formKey].ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList()
.Select(x => x).ToList();
var newShipIds = new List<string>();
diff --git a/src/Web/Grand.Web.Admin/Controllers/PaymentTransactionController.cs b/src/Web/Grand.Web.Admin/Controllers/PaymentTransactionController.cs
index 9bf2db5c2..49b07bce6 100644
--- a/src/Web/Grand.Web.Admin/Controllers/PaymentTransactionController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/PaymentTransactionController.cs
@@ -20,7 +20,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.PaymentTransactions)]
- public partial class PaymentTransactionController : BaseAdminController
+ public class PaymentTransactionController : BaseAdminController
{
#region Fields
@@ -83,11 +83,11 @@ namespace Grand.Web.Admin.Controllers
{
model.StoreId = _workContext.CurrentCustomer.StaffStoreId;
}
- DateTime? startDateValue = (model.StartDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
+ DateTime? startDateValue = model.StartDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
- DateTime? endDateValue = (model.EndDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone);
+ DateTime? endDateValue = model.EndDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone);
Guid? orderGuid = null;
if (!string.IsNullOrEmpty(model.OrderNumber))
@@ -114,28 +114,29 @@ namespace Grand.Web.Admin.Controllers
foreach (var item in paymentTransactions)
{
var order = await _orderService.GetOrderByGuid(item.OrderGuid);
- var trmodel = new PaymentTransactionModel();
- trmodel.Id = item.Id;
- trmodel.OrderCode = item.OrderCode;
- trmodel.CustomerEmail = item.CustomerEmail;
- trmodel.CustomerId = item.CustomerId;
- trmodel.CurrencyCode = item.CurrencyCode;
- trmodel.TransactionAmount = item.TransactionAmount;
- trmodel.PaidAmount = item.PaidAmount;
- trmodel.PaymentMethodSystemName = item.PaymentMethodSystemName;
- trmodel.RefundedAmount = item.RefundedAmount;
- trmodel.OrderId = order?.Id;
- trmodel.OrderNumber = order?.OrderNumber;
- trmodel.CreatedOn = _dateTimeService.ConvertToUserTime(item.CreatedOnUtc, DateTimeKind.Utc);
- trmodel.TransactionStatus = item.TransactionStatus;
- trmodel.Status = item.TransactionStatus.GetTranslationEnum(_translationService, _workContext);
+ var trmodel = new PaymentTransactionModel {
+ Id = item.Id,
+ OrderCode = item.OrderCode,
+ CustomerEmail = item.CustomerEmail,
+ CustomerId = item.CustomerId,
+ CurrencyCode = item.CurrencyCode,
+ TransactionAmount = item.TransactionAmount,
+ PaidAmount = item.PaidAmount,
+ PaymentMethodSystemName = item.PaymentMethodSystemName,
+ RefundedAmount = item.RefundedAmount,
+ OrderId = order?.Id,
+ OrderNumber = order?.OrderNumber,
+ CreatedOn = _dateTimeService.ConvertToUserTime(item.CreatedOnUtc, DateTimeKind.Utc),
+ TransactionStatus = item.TransactionStatus,
+ Status = item.TransactionStatus.GetTranslationEnum(_translationService, _workContext)
+ };
dataModel.Add(trmodel);
}
var gridModel = new DataSourceResult
{
Data = dataModel.ToList(),
- Total = paymentTransactions.TotalCount,
+ Total = paymentTransactions.TotalCount
};
return Json(gridModel);
@@ -181,40 +182,39 @@ namespace Grand.Web.Admin.Controllers
var order = await _orderService.GetOrderByGuid(paymentTransaction.OrderGuid);
- var model = new PaymentTransactionModel();
- model.Id = paymentTransaction.Id;
- model.OrderCode = paymentTransaction.OrderCode;
- model.CustomerEmail = string.IsNullOrEmpty(paymentTransaction.CustomerEmail) ? "(null)" : paymentTransaction.CustomerEmail;
- model.CustomerId = paymentTransaction.CustomerId;
- model.CurrencyCode = paymentTransaction.CurrencyCode;
- model.TransactionAmount = paymentTransaction.TransactionAmount;
- model.PaidAmount = paymentTransaction.PaidAmount;
- model.PaymentMethodSystemName = paymentTransaction.PaymentMethodSystemName;
- model.RefundedAmount = paymentTransaction.RefundedAmount;
- model.OrderId = order?.Id;
- model.OrderNumber = order?.OrderNumber;
- model.CreatedOn = _dateTimeService.ConvertToUserTime(paymentTransaction.CreatedOnUtc, DateTimeKind.Utc);
- model.TransactionStatus = paymentTransaction.TransactionStatus;
- model.Status = paymentTransaction.TransactionStatus.GetTranslationEnum(_translationService, _workContext);
- model.IPAddress = paymentTransaction.IPAddress;
- model.Description = paymentTransaction.Description;
- model.AdditionalInfo = paymentTransaction.AdditionalInfo;
- model.AuthorizationTransactionId = paymentTransaction.AuthorizationTransactionId;
-
- //payment method buttons
- //model.CanCancelOrder = await _mediator.Send(new CanCancelOrderQuery() { Order = order });
- model.CanCapture = await _mediator.Send(new CanCaptureQuery() { PaymentTransaction = paymentTransaction });
- model.CanMarkAsPaid = await _mediator.Send(new CanMarkPaymentTransactionAsPaidQuery() { PaymentTransaction = paymentTransaction });
- model.CanRefund = await _mediator.Send(new CanRefundQuery() { PaymentTransaction = paymentTransaction });
- model.CanRefundOffline = await _mediator.Send(new CanRefundOfflineQuery() { PaymentTransaction = paymentTransaction });
- model.CanPartiallyRefund = await _mediator.Send(new CanPartiallyRefundQuery() { PaymentTransaction = paymentTransaction, AmountToRefund = 0 });
- model.CanPartiallyRefundOffline = await _mediator.Send(new CanPartiallyRefundOfflineQuery() { PaymentTransaction = paymentTransaction, AmountToRefund = 0 });
- model.CanPartiallyPaidOffline = await _mediator.Send(new CanPartiallyPaidOfflineQuery() { PaymentTransaction = paymentTransaction, AmountToPaid = 0 });
- model.CanVoid = await _mediator.Send(new CanVoidQuery() { PaymentTransaction = paymentTransaction });
- model.CanVoidOffline = await _mediator.Send(new CanVoidOfflineQuery() { PaymentTransaction = paymentTransaction });
-
- model.MaxAmountToRefund = paymentTransaction.TransactionAmount - paymentTransaction.RefundedAmount;
- model.MaxAmountToPaid = paymentTransaction.TransactionAmount - paymentTransaction.PaidAmount;
+ var model = new PaymentTransactionModel {
+ Id = paymentTransaction.Id,
+ OrderCode = paymentTransaction.OrderCode,
+ CustomerEmail = string.IsNullOrEmpty(paymentTransaction.CustomerEmail) ? "(null)" : paymentTransaction.CustomerEmail,
+ CustomerId = paymentTransaction.CustomerId,
+ CurrencyCode = paymentTransaction.CurrencyCode,
+ TransactionAmount = paymentTransaction.TransactionAmount,
+ PaidAmount = paymentTransaction.PaidAmount,
+ PaymentMethodSystemName = paymentTransaction.PaymentMethodSystemName,
+ RefundedAmount = paymentTransaction.RefundedAmount,
+ OrderId = order?.Id,
+ OrderNumber = order?.OrderNumber,
+ CreatedOn = _dateTimeService.ConvertToUserTime(paymentTransaction.CreatedOnUtc, DateTimeKind.Utc),
+ TransactionStatus = paymentTransaction.TransactionStatus,
+ Status = paymentTransaction.TransactionStatus.GetTranslationEnum(_translationService, _workContext),
+ IPAddress = paymentTransaction.IPAddress,
+ Description = paymentTransaction.Description,
+ AdditionalInfo = paymentTransaction.AdditionalInfo,
+ AuthorizationTransactionId = paymentTransaction.AuthorizationTransactionId,
+ //payment method buttons
+ //model.CanCancelOrder = await _mediator.Send(new CanCancelOrderQuery() { Order = order });
+ CanCapture = await _mediator.Send(new CanCaptureQuery { PaymentTransaction = paymentTransaction }),
+ CanMarkAsPaid = await _mediator.Send(new CanMarkPaymentTransactionAsPaidQuery { PaymentTransaction = paymentTransaction }),
+ CanRefund = await _mediator.Send(new CanRefundQuery { PaymentTransaction = paymentTransaction }),
+ CanRefundOffline = await _mediator.Send(new CanRefundOfflineQuery { PaymentTransaction = paymentTransaction }),
+ CanPartiallyRefund = await _mediator.Send(new CanPartiallyRefundQuery { PaymentTransaction = paymentTransaction, AmountToRefund = 0 }),
+ CanPartiallyRefundOffline = await _mediator.Send(new CanPartiallyRefundOfflineQuery { PaymentTransaction = paymentTransaction, AmountToRefund = 0 }),
+ CanPartiallyPaidOffline = await _mediator.Send(new CanPartiallyPaidOfflineQuery { PaymentTransaction = paymentTransaction, AmountToPaid = 0 }),
+ CanVoid = await _mediator.Send(new CanVoidQuery { PaymentTransaction = paymentTransaction }),
+ CanVoidOffline = await _mediator.Send(new CanVoidOfflineQuery { PaymentTransaction = paymentTransaction }),
+ MaxAmountToRefund = paymentTransaction.TransactionAmount - paymentTransaction.RefundedAmount,
+ MaxAmountToPaid = paymentTransaction.TransactionAmount - paymentTransaction.PaidAmount
+ };
return View(model);
@@ -236,7 +236,7 @@ namespace Grand.Web.Admin.Controllers
try
{
- var errors = await _mediator.Send(new CaptureCommand() { PaymentTransaction = paymentTransaction });
+ var errors = await _mediator.Send(new CaptureCommand { PaymentTransaction = paymentTransaction });
foreach (var error in errors)
Error(error);
@@ -267,7 +267,7 @@ namespace Grand.Web.Admin.Controllers
try
{
- await _mediator.Send(new MarkAsPaidCommand() { PaymentTransaction = paymentTransaction });
+ await _mediator.Send(new MarkAsPaidCommand { PaymentTransaction = paymentTransaction });
return RedirectToAction("Edit", "PaymentTransaction", new { id });
}
catch (Exception exc)
@@ -293,7 +293,7 @@ namespace Grand.Web.Admin.Controllers
try
{
- var errors = await _mediator.Send(new RefundCommand() { PaymentTransaction = paymentTransaction });
+ var errors = await _mediator.Send(new RefundCommand { PaymentTransaction = paymentTransaction });
foreach (var error in errors)
Error(error);
@@ -322,7 +322,7 @@ namespace Grand.Web.Admin.Controllers
try
{
- await _mediator.Send(new RefundOfflineCommand() { PaymentTransaction = paymentTransaction });
+ await _mediator.Send(new RefundOfflineCommand { PaymentTransaction = paymentTransaction });
return RedirectToAction("Edit", "PaymentTransaction", new { id });
}
catch (Exception exc)
@@ -348,7 +348,7 @@ namespace Grand.Web.Admin.Controllers
try
{
- var errors = await _mediator.Send(new VoidCommand() { PaymentTransaction = paymentTransaction });
+ var errors = await _mediator.Send(new VoidCommand { PaymentTransaction = paymentTransaction });
foreach (var error in errors)
Error(error);
@@ -377,7 +377,7 @@ namespace Grand.Web.Admin.Controllers
try
{
- await _mediator.Send(new VoidOfflineCommand() { PaymentTransaction = paymentTransaction });
+ await _mediator.Send(new VoidOfflineCommand { PaymentTransaction = paymentTransaction });
return RedirectToAction("Edit", "PaymentTransaction", new { id });
}
catch (Exception exc)
@@ -400,10 +400,11 @@ namespace Grand.Web.Admin.Controllers
return RedirectToAction("List", "PaymentTransaction");
}
- var model = new PaymentTransactionModel();
- model.Id = paymentTransaction.Id;
- model.MaxAmountToRefund = paymentTransaction.TransactionAmount - paymentTransaction.RefundedAmount;
- model.CurrencyCode = paymentTransaction.CurrencyCode;
+ var model = new PaymentTransactionModel {
+ Id = paymentTransaction.Id,
+ MaxAmountToRefund = paymentTransaction.TransactionAmount - paymentTransaction.RefundedAmount,
+ CurrencyCode = paymentTransaction.CurrencyCode
+ };
return View(model);
}
@@ -423,11 +424,11 @@ namespace Grand.Web.Admin.Controllers
try
{
- double amountToRefund = model.AmountToRefund;
+ var amountToRefund = model.AmountToRefund;
if (amountToRefund <= 0)
throw new GrandException("Enter amount to refund");
- double maxAmountToRefund = paymentTransaction.TransactionAmount - paymentTransaction.RefundedAmount;
+ var maxAmountToRefund = paymentTransaction.TransactionAmount - paymentTransaction.RefundedAmount;
if (amountToRefund > maxAmountToRefund)
amountToRefund = maxAmountToRefund;
@@ -469,10 +470,11 @@ namespace Grand.Web.Admin.Controllers
return RedirectToAction("List", "PaymentTransaction");
}
- var model = new PaymentTransactionModel();
- model.Id = paymentTransaction.Id;
- model.MaxAmountToPaid = paymentTransaction.TransactionAmount - paymentTransaction.PaidAmount;
- model.CurrencyCode = paymentTransaction.CurrencyCode;
+ var model = new PaymentTransactionModel {
+ Id = paymentTransaction.Id,
+ MaxAmountToPaid = paymentTransaction.TransactionAmount - paymentTransaction.PaidAmount,
+ CurrencyCode = paymentTransaction.CurrencyCode
+ };
return View(model);
}
@@ -492,11 +494,11 @@ namespace Grand.Web.Admin.Controllers
try
{
- double amountToPaid = model.AmountToPaid;
+ var amountToPaid = model.AmountToPaid;
if (amountToPaid <= 0)
throw new GrandException("Enter amount to refund");
- double maxAmountToPaid = paymentTransaction.TransactionAmount - paymentTransaction.PaidAmount;
+ var maxAmountToPaid = paymentTransaction.TransactionAmount - paymentTransaction.PaidAmount;
if (amountToPaid > maxAmountToPaid)
amountToPaid = maxAmountToPaid;
diff --git a/src/Web/Grand.Web.Admin/Controllers/PermissionController.cs b/src/Web/Grand.Web.Admin/Controllers/PermissionController.cs
index 7d4d369d1..b57c3d004 100644
--- a/src/Web/Grand.Web.Admin/Controllers/PermissionController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/PermissionController.cs
@@ -16,7 +16,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Acl)]
- public partial class PermissionController : BaseAdminController
+ public class PermissionController : BaseAdminController
{
#region Fields
@@ -69,12 +69,12 @@ namespace Grand.Web.Admin.Controllers
}
foreach (var cr in customerGroups)
{
- model.AvailableCustomerGroups.Add(new CustomerGroupModel() { Id = cr.Id, Name = cr.Name });
+ model.AvailableCustomerGroups.Add(new CustomerGroupModel { Id = cr.Id, Name = cr.Name });
}
foreach (var pr in permissionRecords)
foreach (var cr in customerGroups)
{
- bool allowed = pr.CustomerGroups.Count(x => x == cr.Id) > 0;
+ var allowed = pr.CustomerGroups.Count(x => x == cr.Id) > 0;
if (!model.Allowed.ContainsKey(pr.SystemName))
model.Allowed[pr.SystemName] = new Dictionary<string, bool>();
model.Allowed[pr.SystemName][cr.Id] = allowed;
@@ -91,12 +91,12 @@ namespace Grand.Web.Admin.Controllers
foreach (var cr in customerGroups)
{
- string formKey = "allow_" + cr.Id;
- var permissionRecordSystemNamesToRestrict = form[formKey].ToString() != null ? form[formKey].ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList() : new List<string>();
+ var formKey = "allow_" + cr.Id;
+ var permissionRecordSystemNamesToRestrict = form[formKey].ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
foreach (var pr in permissionRecords)
{
- bool allow = permissionRecordSystemNamesToRestrict.Contains(pr.SystemName);
+ var allow = permissionRecordSystemNamesToRestrict.Contains(pr.SystemName);
if (allow)
{
@@ -123,9 +123,9 @@ namespace Grand.Web.Admin.Controllers
public async Task<IActionResult> PermissionsAction(string systemName, string customeGroupId)
{
- var model = new PermissionActionModel() {
+ var model = new PermissionActionModel {
SystemName = systemName,
- CustomerGroupId = customeGroupId,
+ CustomerGroupId = customeGroupId
};
var customerGroup = await _groupService.GetCustomerGroupById(customeGroupId);
@@ -177,7 +177,7 @@ namespace Grand.Web.Admin.Controllers
foreach (var item in insertActions)
{
- await _permissionService.InsertPermissionAction(new PermissionAction() {
+ await _permissionService.InsertPermissionAction(new PermissionAction {
Action = item,
CustomerGroupId = customergroupId,
SystemName = systemname
diff --git a/src/Web/Grand.Web.Admin/Controllers/PictureController.cs b/src/Web/Grand.Web.Admin/Controllers/PictureController.cs
index 37ad21c58..336db4a39 100644
--- a/src/Web/Grand.Web.Admin/Controllers/PictureController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/PictureController.cs
@@ -12,7 +12,7 @@ using Grand.Web.Common.Extensions;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Pictures)]
- public partial class PictureController : BaseAdminController
+ public class PictureController : BaseAdminController
{
private readonly IPictureService _pictureService;
private readonly IPermissionService _permissionService;
@@ -44,7 +44,7 @@ namespace Grand.Web.Admin.Controllers
{
success = false,
message = "No file uploaded",
- downloadGuid = Guid.Empty,
+ downloadGuid = Guid.Empty
});
}
if (reference != Reference.None && string.IsNullOrEmpty(objectId))
@@ -52,7 +52,7 @@ namespace Grand.Web.Admin.Controllers
{
success = false,
message = "Please save form before upload new picture",
- downloadGuid = Guid.Empty,
+ downloadGuid = Guid.Empty
});
var qqFileNameParameter = "qqfilename";
@@ -108,7 +108,7 @@ namespace Grand.Web.Admin.Controllers
return Json(new
{
success = false,
- message = "No file uploaded",
+ message = "No file uploaded"
});
}
@@ -156,9 +156,9 @@ namespace Grand.Web.Admin.Controllers
var filepath = _mediaFileStore.GetDirectoryInfo("");
if (filepath != null)
{
- using (var stream = new FileStream(_mediaFileStore.Combine(filepath.PhysicalPath, fileName), FileMode.OpenOrCreate))
+ await using (var stream = new FileStream(_mediaFileStore.Combine(filepath.PhysicalPath, fileName), FileMode.OpenOrCreate))
{
- httpPostedFile.CopyTo(stream);
+ await httpPostedFile.CopyToAsync(stream);
}
return Json(new
{
@@ -187,9 +187,9 @@ namespace Grand.Web.Admin.Controllers
var filepath = _mediaFileStore.GetDirectoryInfo("");
if (filepath != null)
{
- using (var stream = new FileStream(_mediaFileStore.Combine(filepath.PhysicalPath, fileName), FileMode.OpenOrCreate))
+ await using (var stream = new FileStream(_mediaFileStore.Combine(filepath.PhysicalPath, fileName), FileMode.OpenOrCreate))
{
- httpPostedFile.CopyTo(stream);
+ await httpPostedFile.CopyToAsync(stream);
}
return Json(new
{
diff --git a/src/Web/Grand.Web.Admin/Controllers/PluginController.cs b/src/Web/Grand.Web.Admin/Controllers/PluginController.cs
index f2b2a1dd5..93405578e 100644
--- a/src/Web/Grand.Web.Admin/Controllers/PluginController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/PluginController.cs
@@ -7,6 +7,7 @@ using Grand.Infrastructure.Configuration;
using Grand.Infrastructure.Plugins;
using Grand.SharedKernel.Extensions;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Models.Plugins;
using Grand.Web.Common.DataSource;
using Grand.Web.Common.Extensions;
@@ -21,7 +22,7 @@ using System.Reflection;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Plugins)]
- public partial class PluginController : BaseAdminController
+ public class PluginController : BaseAdminController
{
#region Fields
@@ -151,7 +152,7 @@ namespace Grand.Web.Admin.Controllers
var gridModel = new DataSourceResult
{
Data = items,
- Total = pluginInfos.Count()
+ Total = pluginInfos.Count
};
return Json(gridModel);
}
@@ -311,7 +312,7 @@ namespace Grand.Web.Admin.Controllers
return RedirectToAction("List");
}
- string zipFilePath = "";
+ var zipFilePath = "";
try
{
if (!Path.GetExtension(zippedFile.FileName)?.Equals(".zip", StringComparison.InvariantCultureIgnoreCase) ?? true)
@@ -361,7 +362,7 @@ namespace Grand.Web.Admin.Controllers
return RedirectToAction("GeneralCommon", "Setting");
}
- string zipFilePath = "";
+ var zipFilePath = "";
try
{
@@ -417,7 +418,7 @@ namespace Grand.Web.Admin.Controllers
//get directory name (remove the ending /)
uploadedItemDirectoryName = rootDirectories.First().FullName.TrimEnd('/');
- var themeDescriptorEntry = archive.Entries.Where(x => x.FullName.Contains("theme.cfg")).FirstOrDefault();
+ var themeDescriptorEntry = archive.Entries.FirstOrDefault(x => x.FullName.Contains("theme.cfg"));
if (themeDescriptorEntry != null)
{
using var unzippedEntryStream = themeDescriptorEntry.Open();
@@ -430,30 +431,25 @@ namespace Grand.Web.Admin.Controllers
var _fpath = "";
foreach (var entry in archive.Entries.Where(x => x.FullName.Contains(".dll")))
{
- using (var unzippedEntryStream = entry.Open())
+ using var unzippedEntryStream = entry.Open();
+ try
{
- try
+ var assembly = Assembly.Load(ToByteArray(unzippedEntryStream));
+ var pluginInfo = assembly.GetCustomAttribute<PluginInfoAttribute>();
+ if (pluginInfo is { SupportedVersion: GrandVersion.SupportedPluginVersion })
{
- var assembly = Assembly.Load(ToByteArray(unzippedEntryStream));
- var pluginInfo = assembly.GetCustomAttribute<PluginInfoAttribute>();
- if (pluginInfo != null)
- {
- if (pluginInfo.SupportedVersion == GrandVersion.SupportedPluginVersion)
- {
- supportedVersion = true;
- _fpath = entry.FullName[..entry.FullName.LastIndexOf("/")];
- archive.Entries.Where(x => !x.FullName.Contains(_fpath)).ToList()
- .ForEach(y => { archive.GetEntry(y.FullName).Delete(); });
-
- _pluginInfo = new PluginInfo();
- break;
- }
- }
+ supportedVersion = true;
+ _fpath = entry.FullName[..entry.FullName.LastIndexOf("/", StringComparison.Ordinal)];
+ archive.Entries.Where(x => !x.FullName.Contains(_fpath)).ToList()
+ .ForEach(y => { archive.GetEntry(y.FullName)!.Delete(); });
+
+ _pluginInfo = new PluginInfo();
+ break;
}
- catch (Exception ex)
- {
- _ = _logger.Error(ex.Message);
- };
+ }
+ catch (Exception ex)
+ {
+ _ = _logger.Error(ex.Message);
}
}
if (!supportedVersion)
diff --git a/src/Web/Grand.Web.Admin/Controllers/ProductAttributeController.cs b/src/Web/Grand.Web.Admin/Controllers/ProductAttributeController.cs
index a6b75ba40..794d1bc52 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ProductAttributeController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ProductAttributeController.cs
@@ -10,14 +10,14 @@ using Grand.Web.Common.Filters;
using Grand.Web.Common.Security.Authorization;
using Grand.Domain.Seo;
using Grand.Infrastructure;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Models.Catalog;
using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.ProductAttributes)]
- public partial class ProductAttributeController : BaseAdminController
+ public class ProductAttributeController : BaseAdminController
{
#region Fields
private readonly IProductService _productService;
@@ -101,7 +101,7 @@ namespace Grand.Web.Admin.Controllers
productAttribute.SeName = SeoExtensions.GetSeName(string.IsNullOrEmpty(productAttribute.SeName) ? productAttribute.Name : productAttribute.SeName, _seoSettings.ConvertNonWesternChars, _seoSettings.AllowUnicodeCharsInUrls, _seoSettings.SeoCharConversion);
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
- model.Stores = new string[] { _workContext.CurrentCustomer.StaffStoreId };
+ model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };
}
await _productAttributeService.InsertProductAttribute(productAttribute);
@@ -153,7 +153,7 @@ namespace Grand.Web.Admin.Controllers
productAttribute.SeName = SeoExtensions.GetSeName(string.IsNullOrEmpty(productAttribute.SeName) ? productAttribute.Name : productAttribute.SeName, _seoSettings.ConvertNonWesternChars, _seoSettings.AllowUnicodeCharsInUrls, _seoSettings.SeoCharConversion);
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
- model.Stores = new string[] { _workContext.CurrentCustomer.StaffStoreId };
+ model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };
}
await _productAttributeService.UpdateProductAttribute(productAttribute);
@@ -250,7 +250,7 @@ namespace Grand.Web.Admin.Controllers
var gridModel = new DataSourceResult
{
Data = values.Select(x => x.ToModel()),
- Total = values.Count(),
+ Total = values.Count
};
return Json(gridModel);
@@ -298,7 +298,7 @@ namespace Grand.Web.Admin.Controllers
[PermissionAuthorizeAction(PermissionActionName.Edit)]
public async Task<IActionResult> PredefinedProductAttributeValueEditPopup(string id, string productAttributeId)
{
- var ppav = (await _productAttributeService.GetProductAttributeById(productAttributeId)).PredefinedProductAttributeValues.Where(x => x.Id == id).FirstOrDefault();
+ var ppav = (await _productAttributeService.GetProductAttributeById(productAttributeId)).PredefinedProductAttributeValues.FirstOrDefault(x => x.Id == id);
if (ppav == null)
throw new ArgumentException("No product attribute value found with the specified id");
@@ -316,7 +316,7 @@ namespace Grand.Web.Admin.Controllers
public async Task<IActionResult> PredefinedProductAttributeValueEditPopup(PredefinedProductAttributeValueModel model)
{
var productAttribute = await _productAttributeService.GetProductAttributeById(model.ProductAttributeId);
- var ppav = productAttribute.PredefinedProductAttributeValues.Where(x => x.Id == model.Id).FirstOrDefault();
+ var ppav = productAttribute.PredefinedProductAttributeValues.FirstOrDefault(x => x.Id == model.Id);
if (ppav == null)
throw new ArgumentException("No product attribute value found with the specified id");
@@ -338,7 +338,7 @@ namespace Grand.Web.Admin.Controllers
if (ModelState.IsValid)
{
var productAttribute = (await _productAttributeService.GetAllProductAttributes()).FirstOrDefault(x => x.PredefinedProductAttributeValues.Any(y => y.Id == id));
- var ppav = productAttribute.PredefinedProductAttributeValues.Where(x => x.Id == id).FirstOrDefault();
+ var ppav = productAttribute.PredefinedProductAttributeValues.FirstOrDefault(x => x.Id == id);
if (ppav == null)
throw new ArgumentException("No predefined product attribute value found with the specified id");
productAttribute.PredefinedProductAttributeValues.Remove(ppav);
diff --git a/src/Web/Grand.Web.Admin/Controllers/ProductController.cs b/src/Web/Grand.Web.Admin/Controllers/ProductController.cs
index 5c20ea82a..a59479043 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ProductController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ProductController.cs
@@ -15,6 +15,7 @@ using Grand.Domain.Common;
using Grand.Domain.Media;
using Grand.Infrastructure;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Catalog;
using Grand.Web.Admin.Models.Orders;
@@ -30,7 +31,7 @@ using Microsoft.AspNetCore.StaticFiles;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Products)]
- public partial class ProductController : BaseAdminController
+ public class ProductController : BaseAdminController
{
#region Fields
@@ -95,7 +96,7 @@ namespace Grand.Web.Admin.Controllers
//a vendor should have access only to his products
if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
{
- if (product != null && product.VendorId != _workContext.CurrentVendor.Id)
+ if (product.VendorId != _workContext.CurrentVendor.Id)
{
return (false, "This is not your product");
}
@@ -136,7 +137,7 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> GoToSku(ProductListModel model)
{
- string sku = model.GoDirectlyToSku;
+ var sku = model.GoDirectlyToSku;
//try to load a product entity
var product = await _productService.GetProductBySku(sku);
@@ -355,7 +356,7 @@ namespace Grand.Web.Admin.Controllers
picture.AltAttribute,
picture.TitleAttribute,
false,
- Domain.Common.Reference.Product,
+ Reference.Product,
newProduct.Id);
await _productService.InsertProductPicture(new ProductPicture {
@@ -376,7 +377,7 @@ namespace Grand.Web.Admin.Controllers
{
var result = "";
- if (!String.IsNullOrWhiteSpace(productIds))
+ if (!string.IsNullOrWhiteSpace(productIds))
{
var ids = new List<string>();
var rangeArray = productIds
@@ -384,13 +385,13 @@ namespace Grand.Web.Admin.Controllers
.Select(x => x.Trim())
.ToList();
- foreach (string str1 in rangeArray)
+ foreach (var str1 in rangeArray)
{
ids.Add(str1);
}
var products = await _productService.GetProductsByIds(ids.ToArray(), true);
- for (int i = 0; i <= products.Count - 1; i++)
+ for (var i = 0; i <= products.Count - 1; i++)
{
result += products[i].Name;
if (i != products.Count - 1)
@@ -899,7 +900,7 @@ namespace Grand.Web.Admin.Controllers
crossSellProductsModel.Add(new ProductModel.CrossSellProductModel {
Id = x,
ProductId = product.Id,
- Product2Name = (await _productService.GetProductById(x))?.Name,
+ Product2Name = (await _productService.GetProductById(x))?.Name
});
}
var gridModel = new DataSourceResult {
@@ -919,7 +920,7 @@ namespace Grand.Web.Admin.Controllers
{
throw new ArgumentException("Product not exists");
}
- var crossSellProduct = product.CrossSellProduct.Where(x => x == model.Id).FirstOrDefault();
+ var crossSellProduct = product.CrossSellProduct.FirstOrDefault(x => x == model.Id);
if (string.IsNullOrEmpty(crossSellProduct))
throw new ArgumentException("No cross-sell product found with the specified id");
@@ -993,7 +994,7 @@ namespace Grand.Web.Admin.Controllers
recommendedProductsModel.Add(new ProductModel.RecommendedProductModel {
Id = x,
ProductId = product.Id,
- Product2Name = (await _productService.GetProductById(x))?.Name,
+ Product2Name = (await _productService.GetProductById(x))?.Name
});
}
var gridModel = new DataSourceResult {
@@ -1013,7 +1014,7 @@ namespace Grand.Web.Admin.Controllers
{
throw new ArgumentException("Product not exists");
}
- var recommendedProduct = product.RecommendedProduct.Where(x => x == model.Id).FirstOrDefault();
+ var recommendedProduct = product.RecommendedProduct.FirstOrDefault(x => x == model.Id);
if (string.IsNullOrEmpty(recommendedProduct))
throw new ArgumentException("No recommended product found with the specified id");
@@ -1196,14 +1197,14 @@ namespace Grand.Web.Admin.Controllers
return Json(new
{
success = false,
- message = "Access denied - picture permissions",
+ message = "Access denied - picture permissions"
});
if (reference != Reference.Product || string.IsNullOrEmpty(objectId))
return Json(new
{
success = false,
- message = "Please save form before upload new pictures",
+ message = "Please save form before upload new pictures"
});
var form = await HttpContext.Request.ReadFormAsync();
@@ -1213,7 +1214,7 @@ namespace Grand.Web.Admin.Controllers
return Json(new
{
success = false,
- message = "No files uploaded",
+ message = "No files uploaded"
});
}
@@ -1224,7 +1225,7 @@ namespace Grand.Web.Admin.Controllers
return Json(new
{
success = false,
- message = "Access denied - vendor permissions",
+ message = "Access denied - vendor permissions"
});
@@ -1233,11 +1234,10 @@ namespace Grand.Web.Admin.Controllers
return Json(new
{
success = false,
- message = "Access denied - staff permissions",
+ message = "Access denied - staff permissions"
});
var values = new List<(string pictureUrl, string pictureId)>();
- var message = string.Empty;
foreach (var file in httpPostedFiles)
{
var qqFileNameParameter = "qqfilename";
@@ -1267,10 +1267,7 @@ namespace Grand.Web.Admin.Controllers
values.Add((pictureUrl, picture.Id));
//assign picture to the product
await _productViewModelService.InsertProductPicture(product, picture, 0);
-
}
- else
- message += $"Not allowed file types to import {fileName}";
}
return Json(new { success = values.Any(), data = values });
@@ -1430,7 +1427,7 @@ namespace Grand.Web.Admin.Controllers
if (product == null)
return Content("Product not exists");
- var psa = product.ProductSpecificationAttributes.Where(x => x.Id == model.Id).FirstOrDefault();
+ var psa = product.ProductSpecificationAttributes.FirstOrDefault(x => x.Id == model.Id);
if (psa == null)
await _productViewModelService.InsertProductSpecificationAttributeModel(model, product);
else
@@ -1451,7 +1448,7 @@ namespace Grand.Web.Admin.Controllers
{
availableSpecificationAttributes.Add(new SelectListItem {
Text = sa.Name,
- Value = sa.Id.ToString()
+ Value = sa.Id
});
}
return availableSpecificationAttributes;
@@ -1467,7 +1464,7 @@ namespace Grand.Web.Admin.Controllers
if (product == null)
return Content("Product not exists");
- var psa = product.ProductSpecificationAttributes.Where(x => x.Id == model.Id).FirstOrDefault();
+ var psa = product.ProductSpecificationAttributes.FirstOrDefault(x => x.Id == model.Id);
if (psa == null)
throw new ArgumentException("No specification attribute found with the specified id");
@@ -1546,7 +1543,7 @@ namespace Grand.Web.Admin.Controllers
}
var gridModel = new DataSourceResult {
Data = items,
- Total = productReviews.Count,
+ Total = productReviews.Count
};
return Json(gridModel);
@@ -1563,7 +1560,7 @@ namespace Grand.Web.Admin.Controllers
var products = await _productViewModelService.PrepareProducts(model);
try
{
- byte[] bytes = await exportManager.Export(products);
+ var bytes = await exportManager.Export(products);
return File(bytes, "text/xls", "products.xlsx");
}
catch (Exception exc)
@@ -1592,7 +1589,7 @@ namespace Grand.Web.Admin.Controllers
products = products.Where(p => p.VendorId == _workContext.CurrentVendor.Id).ToList();
}
- byte[] bytes = await exportManager.Export(products);
+ var bytes = await exportManager.Export(products);
return File(bytes, "text/xls", "products.xlsx");
}
@@ -1606,7 +1603,7 @@ namespace Grand.Web.Admin.Controllers
try
{
- if (importexcelfile != null && importexcelfile.Length > 0)
+ if (importexcelfile is { Length: > 0 })
{
await importManager.Import(importexcelfile.OpenReadStream());
}
@@ -1688,7 +1685,7 @@ namespace Grand.Web.Admin.Controllers
var items = new List<ProductModel.ProductPriceModel>();
foreach (var item in product.ProductPrices)
{
- items.Add(new ProductModel.ProductPriceModel() {
+ items.Add(new ProductModel.ProductPriceModel {
Id = item.Id,
CurrencyCode = item.CurrencyCode,
Price = item.Price
@@ -1711,17 +1708,17 @@ namespace Grand.Web.Admin.Controllers
if (product == null)
throw new ArgumentException("No product found with the specified id");
- if (product.ProductPrices.Where(x => x.CurrencyCode == model.CurrencyCode).Any())
+ if (product.ProductPrices.Any(x => x.CurrencyCode == model.CurrencyCode))
ModelState.AddModelError("", "Currency code exists");
if (ModelState.IsValid)
{
try
{
- await _productService.InsertProductPrice(new ProductPrice() {
+ await _productService.InsertProductPrice(new ProductPrice {
ProductId = product.Id,
CurrencyCode = model.CurrencyCode,
- Price = model.Price,
+ Price = model.Price
});
return new JsonResult("");
}
@@ -1745,14 +1742,14 @@ namespace Grand.Web.Admin.Controllers
if (productPrice == null)
ModelState.AddModelError("", "Product price model not exists");
- if (product.ProductPrices.Where(x => x.Id != model.Id && x.CurrencyCode == model.CurrencyCode).Any())
+ if (product.ProductPrices.Any(x => x.Id != model.Id && x.CurrencyCode == model.CurrencyCode))
ModelState.AddModelError("", "You can't use this currency code");
if (ModelState.IsValid)
{
try
{
- productPrice.CurrencyCode = model.CurrencyCode;
+ productPrice!.CurrencyCode = model.CurrencyCode;
productPrice.Price = model.Price;
productPrice.ProductId = productId;
@@ -1782,7 +1779,7 @@ namespace Grand.Web.Admin.Controllers
if (ModelState.IsValid)
{
- productPrice.ProductId = productId;
+ productPrice!.ProductId = productId;
await _productService.DeleteProductPrice(productPrice);
return new JsonResult("");
@@ -1853,7 +1850,7 @@ namespace Grand.Web.Admin.Controllers
if (product == null)
throw new ArgumentException("No product found with the specified id");
- var tierPrice = product.TierPrices.Where(x => x.Id == id).FirstOrDefault();
+ var tierPrice = product.TierPrices.FirstOrDefault(x => x.Id == id);
if (tierPrice == null)
return Content("Empty tier price");
@@ -1877,7 +1874,7 @@ namespace Grand.Web.Admin.Controllers
if (product == null)
throw new ArgumentException("No product found with the specified id");
- var tierPrice = product.TierPrices.Where(x => x.Id == model.Id).FirstOrDefault();
+ var tierPrice = product.TierPrices.FirstOrDefault(x => x.Id == model.Id);
if (tierPrice == null)
return Content("Empty tier price");
@@ -1902,7 +1899,7 @@ namespace Grand.Web.Admin.Controllers
if (product == null)
throw new ArgumentException("No product found with the specified id");
- var tierPrice = product.TierPrices.Where(x => x.Id == model.Id).FirstOrDefault();
+ var tierPrice = product.TierPrices.FirstOrDefault(x => x.Id == model.Id);
if (tierPrice == null)
throw new ArgumentException("No tier price found with the specified id");
@@ -1987,7 +1984,7 @@ namespace Grand.Web.Admin.Controllers
if (product == null)
throw new ArgumentException("No product found with the specified id");
- var productAttributeMapping = product.ProductAttributeMappings.Where(x => x.Id == id).FirstOrDefault();
+ var productAttributeMapping = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == id);
if (productAttributeMapping == null)
throw new ArgumentException("No product attribute mapping found with the specified id");
@@ -2013,7 +2010,7 @@ namespace Grand.Web.Admin.Controllers
if (!permission.allow)
return Content(permission.message);
- var productAttributeMapping = product.ProductAttributeMappings.Where(x => x.Id == id).FirstOrDefault();
+ var productAttributeMapping = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == id);
if (productAttributeMapping == null)
return Content("No attribute value found with the specified id");
@@ -2030,7 +2027,7 @@ namespace Grand.Web.Admin.Controllers
if (product == null)
throw new ArgumentException("No product found with the specified id");
- var productAttributeMapping = product.ProductAttributeMappings.Where(x => x.Id == model.Id).FirstOrDefault();
+ var productAttributeMapping = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == model.Id);
if (productAttributeMapping == null)
throw new ArgumentException("No attribute value found with the specified id");
@@ -2057,7 +2054,7 @@ namespace Grand.Web.Admin.Controllers
if (!permission.allow)
return Content(permission.message);
- var productAttributeMapping = product.ProductAttributeMappings.Where(x => x.Id == productAttributeMappingId).FirstOrDefault();
+ var productAttributeMapping = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == productAttributeMappingId);
if (productAttributeMapping == null)
//No attribute value found with the specified id
return Content("No attribute value found with the specified id");
@@ -2074,7 +2071,7 @@ namespace Grand.Web.Admin.Controllers
if (product == null)
throw new ArgumentException("No product found with the specified id");
- var productAttributeMapping = product.ProductAttributeMappings.Where(x => x.Id == model.ProductAttributeMappingId).FirstOrDefault();
+ var productAttributeMapping = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == model.ProductAttributeMappingId);
if (productAttributeMapping == null)
return Content("No attribute value found with the specified id");
@@ -2107,7 +2104,7 @@ namespace Grand.Web.Admin.Controllers
if (product == null)
throw new ArgumentException("No product found with the specified id");
- var productAttributeMapping = product.ProductAttributeMappings.Where(x => x.Id == productAttributeMappingId).FirstOrDefault();
+ var productAttributeMapping = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == productAttributeMappingId);
if (productAttributeMapping == null)
throw new ArgumentException("No product attribute mapping found with the specified id");
@@ -2125,7 +2122,7 @@ namespace Grand.Web.Admin.Controllers
ProductName = product.Name,
ProductId = product.Id,
ProductAttributeName = productAttribute.Name,
- ProductAttributeMappingId = productAttributeMappingId,
+ ProductAttributeMappingId = productAttributeMappingId
};
return View(model);
@@ -2141,14 +2138,14 @@ namespace Grand.Web.Admin.Controllers
if (!permission.allow)
return ErrorForKendoGridJson(permission.message);
- var productAttributeMapping = product.ProductAttributeMappings.Where(x => x.Id == productAttributeMappingId).FirstOrDefault();
+ var productAttributeMapping = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == productAttributeMappingId);
if (productAttributeMapping == null)
throw new ArgumentException("No product attribute mapping found with the specified id");
var values = await _productViewModelService.PrepareProductAttributeValueModels(product, productAttributeMapping);
var gridModel = new DataSourceResult {
Data = values,
- Total = values.Count()
+ Total = values.Count
};
return Json(gridModel);
}
@@ -2163,7 +2160,7 @@ namespace Grand.Web.Admin.Controllers
if (!permission.allow)
return Content(permission.message);
- var productAttributeMapping = product.ProductAttributeMappings.Where(x => x.Id == productAttributeMappingId).FirstOrDefault();
+ var productAttributeMapping = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == productAttributeMappingId);
if (productAttributeMapping == null)
throw new ArgumentException("No product attribute mapping found with the specified id");
@@ -2182,7 +2179,7 @@ namespace Grand.Web.Admin.Controllers
if (product == null)
throw new ArgumentException("No product found with the specified id");
- var productAttributeMapping = product.ProductAttributeMappings.Where(x => x.Id == model.ProductAttributeMappingId).FirstOrDefault();
+ var productAttributeMapping = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == model.ProductAttributeMappingId);
if (productAttributeMapping == null)
//No product attribute found with the specified id
return RedirectToAction("List", "Product");
@@ -2221,11 +2218,11 @@ namespace Grand.Web.Admin.Controllers
if (!permission.allow)
return ErrorForKendoGridJson(permission.message);
- var pa = product.ProductAttributeMappings.Where(x => x.Id == productAttributeMappingId).FirstOrDefault();
+ var pa = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == productAttributeMappingId);
if (pa == null)
return RedirectToAction("List", "Product");
- var pav = pa.ProductAttributeValues.Where(x => x.Id == id).FirstOrDefault();
+ var pav = pa.ProductAttributeValues.FirstOrDefault(x => x.Id == id);
if (pav == null)
//No attribute value found with the specified id
return RedirectToAction("List", "Product");
@@ -2249,13 +2246,13 @@ namespace Grand.Web.Admin.Controllers
if (product == null)
throw new ArgumentException("No product found with the specified id");
- var pav = product.ProductAttributeMappings.Where(x => x.Id == model.ProductAttributeMappingId).FirstOrDefault().ProductAttributeValues.Where(x => x.Id == model.Id).FirstOrDefault();
+ var pav = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == model.ProductAttributeMappingId)?.ProductAttributeValues.FirstOrDefault(x => x.Id == model.Id);
if (pav == null)
//No attribute value found with the specified id
return RedirectToAction("List", "Product");
- var productAttributeMapping = product.ProductAttributeMappings.Where(x => x.Id == model.ProductAttributeMappingId).FirstOrDefault();
- if (productAttributeMapping.AttributeControlTypeId == AttributeControlType.ColorSquares)
+ var productAttributeMapping = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == model.ProductAttributeMappingId);
+ if (productAttributeMapping?.AttributeControlTypeId == AttributeControlType.ColorSquares)
{
//ensure valid color is chosen/entered
if (string.IsNullOrEmpty(model.ColorSquaresRgb))
@@ -2263,7 +2260,7 @@ namespace Grand.Web.Admin.Controllers
}
//ensure a picture is uploaded
- if (productAttributeMapping.AttributeControlTypeId == AttributeControlType.ImageSquares && String.IsNullOrEmpty(model.ImageSquaresPictureId))
+ if (productAttributeMapping?.AttributeControlTypeId == AttributeControlType.ImageSquares && string.IsNullOrEmpty(model.ImageSquaresPictureId))
{
ModelState.AddModelError("", "Image is required");
}
@@ -2281,13 +2278,13 @@ namespace Grand.Web.Admin.Controllers
//delete
[PermissionAuthorizeAction(PermissionActionName.Edit)]
[HttpPost]
- public async Task<IActionResult> ProductAttributeValueDelete(string Id, string pam, string productId, [FromServices] IProductAttributeService productAttributeService)
+ public async Task<IActionResult> ProductAttributeValueDelete(string id, string pam, string productId, [FromServices] IProductAttributeService productAttributeService)
{
var product = await _productService.GetProductById(productId);
if (product == null)
throw new ArgumentException("No product found with the specified id");
- var pav = product.ProductAttributeMappings.Where(x => x.Id == pam).FirstOrDefault().ProductAttributeValues.Where(x => x.Id == Id).FirstOrDefault();
+ var pav = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == pam)?.ProductAttributeValues.FirstOrDefault(x => x.Id == id);
if (pav == null)
throw new ArgumentException("No product attribute value found with the specified id");
@@ -2371,7 +2368,7 @@ namespace Grand.Web.Admin.Controllers
if (product == null)
throw new ArgumentException("No product found with the specified id");
- var combination = product.ProductAttributeCombinations.Where(x => x.Id == id).FirstOrDefault();
+ var combination = product.ProductAttributeCombinations.FirstOrDefault(x => x.Id == id);
if (combination == null)
throw new ArgumentException("No product attribute combination found with the specified id");
@@ -2668,7 +2665,7 @@ namespace Grand.Web.Admin.Controllers
if (reservations.Any())
{
if (((product.IntervalUnitId == IntervalUnit.Minute || product.IntervalUnitId == IntervalUnit.Hour) && (IntervalUnit)model.Interval == IntervalUnit.Day) ||
- (product.IntervalUnitId == IntervalUnit.Day) && (((IntervalUnit)model.IntervalUnit == IntervalUnit.Minute || (IntervalUnit)model.IntervalUnit == IntervalUnit.Hour)))
+ product.IntervalUnitId == IntervalUnit.Day && ((IntervalUnit)model.IntervalUnit == IntervalUnit.Minute || (IntervalUnit)model.IntervalUnit == IntervalUnit.Hour))
{
return Json(new { errors = _translationService.GetResource("Admin.Catalog.Products.Calendar.CannotChangeInterval") });
}
@@ -2677,12 +2674,12 @@ namespace Grand.Web.Admin.Controllers
if (!ModelState.IsValid)
{
Dictionary<string, Dictionary<string, object>> error = (Dictionary<string, Dictionary<string, object>>)ModelState.SerializeErrors();
- string s = "";
+ var s = "";
foreach (var error1 in error)
{
foreach (var error2 in error1.Value)
{
- string[] v = (string[])error2.Value;
+ var v = (string[])error2.Value;
s += v[0] + "\n";
}
}
@@ -2695,7 +2692,7 @@ namespace Grand.Web.Admin.Controllers
await _productService.UpdateProductField(product, x => x.IntervalUnitId, (IntervalUnit)model.IntervalUnit);
await _productService.UpdateProductField(product, x => x.IncBothDate, model.IncBothDate);
- int minutesToAdd = 0;
+ var minutesToAdd = 0;
if ((IntervalUnit)model.IntervalUnit == IntervalUnit.Minute)
{
minutesToAdd = model.Interval;
@@ -2709,10 +2706,10 @@ namespace Grand.Web.Admin.Controllers
minutesToAdd = model.Interval * 60 * 24;
}
- int _hourFrom = model.StartTime.Hour;
- int _minutesFrom = model.StartTime.Minute;
- int _hourTo = model.EndTime.Hour;
- int _minutesTo = model.EndTime.Minute;
+ var _hourFrom = model.StartTime.Hour;
+ var _minutesFrom = model.StartTime.Minute;
+ var _hourTo = model.EndTime.Hour;
+ var _minutesTo = model.EndTime.Minute;
DateTime _dateFrom = new DateTime(model.StartDate.Value.Year, model.StartDate.Value.Month, model.StartDate.Value.Day, 0, 0, 0, 0);
DateTime _dateTo = new DateTime(model.EndDate.Value.Year, model.EndDate.Value.Month, model.EndDate.Value.Day, 23, 59, 59, 999);
if ((IntervalUnit)model.IntervalUnit == IntervalUnit.Day)
@@ -2726,7 +2723,7 @@ namespace Grand.Web.Admin.Controllers
}
List<DateTime> dates = new List<DateTime>();
- int counter = 0;
+ var counter = 0;
for (DateTime iterator = _dateFrom; iterator <= _dateTo; iterator += new TimeSpan(0, minutesToAdd, 0))
{
if ((IntervalUnit)model.IntervalUnit != IntervalUnit.Day)
@@ -2765,15 +2762,15 @@ namespace Grand.Web.Admin.Controllers
continue;
}
- for (int i = 0; i < model.Quantity; i++)
+ for (var i = 0; i < model.Quantity; i++)
{
dates.Add(iterator);
try
{
var insert = true;
- if (((IntervalUnit)model.IntervalUnit) == IntervalUnit.Day)
+ if ((IntervalUnit)model.IntervalUnit == IntervalUnit.Day)
{
- if (reservations.Where(x => x.Resource == model.Resource && x.Date == iterator).Any())
+ if (reservations.Any(x => x.Resource == model.Resource && x.Date == iterator))
insert = false;
}
if (insert)
@@ -2787,7 +2784,7 @@ namespace Grand.Web.Admin.Controllers
ProductId = productId,
Resource = model.Resource,
Parameter = model.Parameter,
- Duration = model.Interval + " " + ((IntervalUnit)model.IntervalUnit).GetTranslationEnum(_translationService, _workContext),
+ Duration = model.Interval + " " + ((IntervalUnit)model.IntervalUnit).GetTranslationEnum(_translationService, _workContext)
});
}
}
diff --git a/src/Web/Grand.Web.Admin/Controllers/ProductReviewController.cs b/src/Web/Grand.Web.Admin/Controllers/ProductReviewController.cs
index 457943d23..f8349437f 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ProductReviewController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ProductReviewController.cs
@@ -13,7 +13,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.ProductReviews)]
- public partial class ProductReviewController : BaseAdminController
+ public class ProductReviewController : BaseAdminController
{
#region Fields
@@ -65,7 +65,7 @@ namespace Grand.Web.Admin.Controllers
var (productReviewModels, totalCount) = await _productReviewViewModelService.PrepareProductReviewsModel(model, command.Page, command.PageSize);
var gridModel = new DataSourceResult {
Data = productReviewModels.ToList(),
- Total = totalCount,
+ Total = totalCount
};
return Json(gridModel);
@@ -109,7 +109,7 @@ namespace Grand.Web.Admin.Controllers
{
productReview = await _productReviewViewModelService.UpdateProductReview(productReview, model);
Success(_translationService.GetResource("Admin.Catalog.ProductReviews.Updated"));
- return continueEditing ? RedirectToAction("Edit", new { id = productReview.Id, ProductId = productReview.ProductId }) : RedirectToAction("List");
+ return continueEditing ? RedirectToAction("Edit", new { id = productReview.Id, productReview.ProductId }) : RedirectToAction("List");
}
//If we got this far, something failed, redisplay form
diff --git a/src/Web/Grand.Web.Admin/Controllers/ProductTagsController.cs b/src/Web/Grand.Web.Admin/Controllers/ProductTagsController.cs
index 82378653c..dbcaf15af 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ProductTagsController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ProductTagsController.cs
@@ -13,7 +13,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.ProductTags)]
- public partial class ProductTagsController : BaseAdminController
+ public class ProductTagsController : BaseAdminController
{
private readonly IProductTagService _productTagService;
private readonly IProductService _productService;
@@ -43,21 +43,22 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> List(DataSourceRequest command)
{
- var tags = (await _productTagService.GetAllProductTags());
+ var tags = await _productTagService.GetAllProductTags();
var productTags = new List<ProductTagModel>();
foreach (var item in tags)
{
- var ptag = new ProductTagModel();
- ptag.Id = item.Id;
- ptag.Name = item.Name;
- ptag.ProductCount = await _productTagService.GetProductCount(item.Id, "");
+ var ptag = new ProductTagModel {
+ Id = item.Id,
+ Name = item.Name,
+ ProductCount = await _productTagService.GetProductCount(item.Id, "")
+ };
productTags.Add(ptag);
}
var gridModel = new DataSourceResult
{
Data = productTags.OrderByDescending(x => x.ProductCount).PagedForCommand(command),
- Total = tags.Count()
+ Total = tags.Count
};
return Json(gridModel);
@@ -74,8 +75,7 @@ namespace Grand.Web.Admin.Controllers
{
Data = products.Select(x => new
{
- Id = x.Id,
- Name = x.Name,
+ x.Id, x.Name
}),
Total = products.TotalCount
};
diff --git a/src/Web/Grand.Web.Admin/Controllers/PushNotificationsController.cs b/src/Web/Grand.Web.Admin/Controllers/PushNotificationsController.cs
index 7e7806fc7..a246b5594 100644
--- a/src/Web/Grand.Web.Admin/Controllers/PushNotificationsController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/PushNotificationsController.cs
@@ -65,7 +65,7 @@ namespace Grand.Web.Admin.Controllers
_pushNotificationsSettings.ClickUrl = model.ClickUrl;
await _settingService.SaveSetting(_pushNotificationsSettings);
var pictureUrl = await _pictureService.GetPictureUrl(model.PictureId);
- var result = (await _pushNotificationsService.SendPushNotification(model.Title, model.MessageText, pictureUrl, model.ClickUrl));
+ var result = await _pushNotificationsService.SendPushNotification(model.Title, model.MessageText, pictureUrl, model.ClickUrl);
if (result.Item1)
{
Success(result.Item2);
diff --git a/src/Web/Grand.Web.Admin/Controllers/QueuedEmailController.cs b/src/Web/Grand.Web.Admin/Controllers/QueuedEmailController.cs
index e82aa8f43..7d608b172 100644
--- a/src/Web/Grand.Web.Admin/Controllers/QueuedEmailController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/QueuedEmailController.cs
@@ -6,7 +6,7 @@ using Grand.Business.Core.Interfaces.Messages;
using Grand.Domain;
using Grand.Domain.Messages;
using Grand.Infrastructure;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Models.Messages;
using Grand.Web.Common.DataSource;
using Grand.Web.Common.Filters;
@@ -16,7 +16,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.MessageQueue)]
- public partial class QueuedEmailController : BaseAdminController
+ public class QueuedEmailController : BaseAdminController
{
private readonly IQueuedEmailService _queuedEmailService;
private readonly IEmailAccountService _emailAccountService;
@@ -43,7 +43,7 @@ namespace Grand.Web.Admin.Controllers
Data = queuedEmails.Select((Func<QueuedEmail, QueuedEmailModel>)(x =>
{
var m = x.ToModel();
- m.PriorityName = TranslateExtensions.GetTranslationEnum<QueuedEmailPriority>(x.PriorityId, (ITranslationService)_translationService, (IWorkContext)_workContext);
+ m.PriorityName = x.PriorityId.GetTranslationEnum(_translationService, _workContext);
m.CreatedOn = _dateTimeService.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc);
if (x.DontSendBeforeDateUtc.HasValue)
m.DontSendBeforeDate = _dateTimeService.ConvertToUserTime(x.DontSendBeforeDateUtc.Value, DateTimeKind.Utc);
@@ -77,11 +77,11 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> QueuedEmailList(DataSourceRequest command, QueuedEmailListModel model)
{
- DateTime? startDateValue = (model.SearchStartDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.SearchStartDate.Value, _dateTimeService.CurrentTimeZone);
+ DateTime? startDateValue = model.SearchStartDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.SearchStartDate.Value, _dateTimeService.CurrentTimeZone);
- DateTime? endDateValue = (model.SearchEndDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.SearchEndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
+ DateTime? endDateValue = model.SearchEndDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.SearchEndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
var queuedEmails = await _queuedEmailService.SearchEmails(model.SearchFromEmail, model.SearchToEmail, model.SearchText,
startDateValue, endDateValue,
@@ -138,8 +138,8 @@ namespace Grand.Web.Admin.Controllers
if (ModelState.IsValid)
{
email = model.ToEntity(email);
- email.DontSendBeforeDateUtc = (model.SendImmediately || !model.DontSendBeforeDate.HasValue) ?
- null : (DateTime?)_dateTimeService.ConvertToUtcTime(model.DontSendBeforeDate.Value);
+ email.DontSendBeforeDateUtc = model.SendImmediately || !model.DontSendBeforeDate.HasValue ?
+ null : _dateTimeService.ConvertToUtcTime(model.DontSendBeforeDate.Value);
await _queuedEmailService.UpdateQueuedEmail(email);
Success(_translationService.GetResource("Admin.System.QueuedEmails.Updated"));
@@ -185,8 +185,8 @@ namespace Grand.Web.Admin.Controllers
AttachedDownloads = queuedEmail.AttachedDownloads,
CreatedOnUtc = DateTime.UtcNow,
EmailAccountId = queuedEmail.EmailAccountId,
- DontSendBeforeDateUtc = (queuedEmailModel.SendImmediately || !queuedEmailModel.DontSendBeforeDate.HasValue) ?
- null : (DateTime?)_dateTimeService.ConvertToUtcTime(queuedEmailModel.DontSendBeforeDate.Value)
+ DontSendBeforeDateUtc = queuedEmailModel.SendImmediately || !queuedEmailModel.DontSendBeforeDate.HasValue ?
+ null : _dateTimeService.ConvertToUtcTime(queuedEmailModel.DontSendBeforeDate.Value)
};
await _queuedEmailService.InsertQueuedEmail(requeuedEmail);
diff --git a/src/Web/Grand.Web.Admin/Controllers/ReportsController.cs b/src/Web/Grand.Web.Admin/Controllers/ReportsController.cs
index bb98e647e..702efaf50 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ReportsController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ReportsController.cs
@@ -98,11 +98,11 @@ namespace Grand.Web.Admin.Controllers
int pageSize, int orderBy)
{
//a vendor should have access only to his products
- string vendorId = "";
+ var vendorId = "";
if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
vendorId = _workContext.CurrentVendor.Id;
- string storeId = "";
+ var storeId = "";
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
storeId = _workContext.CurrentCustomer.StaffStoreId;
@@ -119,7 +119,7 @@ namespace Grand.Web.Admin.Controllers
var m = new BestsellersReportLineModel {
ProductId = x.ProductId,
TotalAmount = _priceFormatter.FormatPrice(x.TotalAmount, false),
- TotalQuantity = x.TotalQuantity,
+ TotalQuantity = x.TotalQuantity
};
var product = await _productService.GetProductById(x.ProductId);
if (product != null)
@@ -201,18 +201,18 @@ namespace Grand.Web.Admin.Controllers
IsLoggedInAsVendor = _workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer)
};
- string storeId = "";
+ var storeId = "";
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
storeId = _workContext.CurrentCustomer.StaffStoreId;
//stores
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" });
foreach (var s in (await _storeService.GetAllStores()).Where(x => x.Id == storeId || string.IsNullOrWhiteSpace(storeId)))
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
var status = await _orderStatusService.GetAll();
//order statuses
- model.AvailableOrderStatuses = status.Select(x => new SelectListItem() { Value = x.StatusId.ToString(), Text = x.Name }).ToList();
+ model.AvailableOrderStatuses = status.Select(x => new SelectListItem { Value = x.StatusId.ToString(), Text = x.Name }).ToList();
model.AvailableOrderStatuses.Insert(0, new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" });
//payment statuses
@@ -222,7 +222,7 @@ namespace Grand.Web.Admin.Controllers
//billing countries
foreach (var c in await _countryService.GetAllCountriesForBilling(showHidden: true))
{
- model.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id.ToString() });
+ model.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id });
}
model.AvailableCountries.Insert(0, new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" });
@@ -230,7 +230,7 @@ namespace Grand.Web.Admin.Controllers
model.AvailableVendors.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" });
var vendors = await _vendorService.GetAllVendors(showHidden: true);
foreach (var v in vendors)
- model.AvailableVendors.Add(new SelectListItem { Text = v.Name, Value = v.Id.ToString() });
+ model.AvailableVendors.Add(new SelectListItem { Text = v.Name, Value = v.Id });
return View(model);
}
@@ -247,14 +247,14 @@ namespace Grand.Web.Admin.Controllers
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
model.StoreId = _workContext.CurrentCustomer.StaffStoreId;
- DateTime? startDateValue = (model.StartDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
+ DateTime? startDateValue = model.StartDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
- DateTime? endDateValue = (model.EndDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
+ DateTime? endDateValue = model.EndDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
int? orderStatus = model.OrderStatusId > 0 ? model.OrderStatusId : null;
- PaymentStatus? paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)(model.PaymentStatusId) : null;
+ PaymentStatus? paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)model.PaymentStatusId : null;
var items = await _orderReportService.BestSellersReport(
createdFromUtc: startDateValue,
@@ -275,14 +275,14 @@ namespace Grand.Web.Admin.Controllers
var m = new BestsellersReportLineModel {
ProductId = x.ProductId,
TotalAmount = _priceFormatter.FormatPrice(x.TotalAmount, false),
- TotalQuantity = x.TotalQuantity,
+ TotalQuantity = x.TotalQuantity
};
var product = await _productService.GetProductById(x.ProductId);
if (product != null)
m.ProductName = product.Name;
if (_workContext.CurrentVendor != null)
{
- if (product.VendorId == _workContext.CurrentVendor.Id)
+ if (product?.VendorId == _workContext.CurrentVendor.Id)
result.Add(m);
}
else
@@ -317,7 +317,7 @@ namespace Grand.Web.Admin.Controllers
if (!await _permissionService.Authorize(StandardPermission.ManageOrders))
return Content("");
- string storeId = "";
+ var storeId = "";
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
storeId = _workContext.CurrentCustomer.StaffStoreId;
@@ -338,17 +338,17 @@ namespace Grand.Web.Admin.Controllers
public async Task<IActionResult> NeverSoldReportList(DataSourceRequest command, NeverSoldReportModel model)
{
//a vendor should have access only to his products
- string vendorId = "";
+ var vendorId = "";
if (_workContext.CurrentVendor != null)
vendorId = _workContext.CurrentVendor.Id;
- DateTime? startDateValue = (model.StartDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
+ DateTime? startDateValue = model.StartDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
- DateTime? endDateValue = (model.EndDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
+ DateTime? endDateValue = model.EndDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
- string storeId = "";
+ var storeId = "";
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
storeId = _workContext.CurrentCustomer.StaffStoreId;
@@ -359,7 +359,7 @@ namespace Grand.Web.Admin.Controllers
Data = items.Select(x =>
new NeverSoldReportLineModel {
ProductId = x.Id,
- ProductName = x.Name,
+ ProductName = x.Name
}),
Total = items.TotalCount
};
@@ -377,7 +377,7 @@ namespace Grand.Web.Admin.Controllers
if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
return Content("");
- string storeId = "";
+ var storeId = "";
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
storeId = _workContext.CurrentCustomer.StaffStoreId;
@@ -397,7 +397,7 @@ namespace Grand.Web.Admin.Controllers
SumThisWeekOrders = _priceFormatter.FormatPrice(x.SumThisWeekOrders, false),
SumThisMonthOrders = _priceFormatter.FormatPrice(x.SumThisMonthOrders, false),
SumThisYearOrders = _priceFormatter.FormatPrice(x.SumThisYearOrders, false),
- SumAllTimeOrders = _priceFormatter.FormatPrice(x.SumAllTimeOrders, false),
+ SumAllTimeOrders = _priceFormatter.FormatPrice(x.SumAllTimeOrders, false)
}).ToList();
var gridModel = new DataSourceResult {
@@ -418,7 +418,7 @@ namespace Grand.Web.Admin.Controllers
if (_workContext.CurrentVendor != null)
return Content("");
- string storeId = "";
+ var storeId = "";
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
storeId = _workContext.CurrentCustomer.StaffStoreId;
@@ -445,7 +445,7 @@ namespace Grand.Web.Admin.Controllers
PaymentStatus = x.PaymentStatusId.GetTranslationEnum(_translationService, _workContext),
ShippingStatus = x.ShippingStatusId.GetTranslationEnum(_translationService, _workContext),
CustomerEmail = x.BillingAddress.Email,
- CustomerFullName = string.Format("{0} {1}", x.BillingAddress.FirstName, x.BillingAddress.LastName),
+ CustomerFullName = $"{x.BillingAddress.FirstName} {x.BillingAddress.LastName}",
CreatedOn = _dateTimeService.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc)
});
}
@@ -466,7 +466,7 @@ namespace Grand.Web.Admin.Controllers
if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
return Content("");
- string storeId = "";
+ var storeId = "";
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
storeId = _workContext.CurrentCustomer.StaffStoreId;
@@ -513,7 +513,7 @@ namespace Grand.Web.Admin.Controllers
var status = await _orderStatusService.GetAll();
var model = new CountryReportModel {
//order statuses
- AvailableOrderStatuses = status.Select(x => new SelectListItem() { Value = x.StatusId.ToString(), Text = x.Name }).ToList()
+ AvailableOrderStatuses = status.Select(x => new SelectListItem { Value = x.StatusId.ToString(), Text = x.Name }).ToList()
};
model.AvailableOrderStatuses.Insert(0, new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" });
@@ -528,16 +528,16 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> CountryReportList(DataSourceRequest command, CountryReportModel model)
{
- DateTime? startDateValue = (model.StartDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
+ DateTime? startDateValue = model.StartDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
- DateTime? endDateValue = (model.EndDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
+ DateTime? endDateValue = model.EndDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
int? orderStatus = model.OrderStatusId > 0 ? model.OrderStatusId : null;
- PaymentStatus? paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)(model.PaymentStatusId) : null;
+ PaymentStatus? paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)model.PaymentStatusId : null;
- string storeId = "";
+ var storeId = "";
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
storeId = _workContext.CurrentCustomer.StaffStoreId;
@@ -550,11 +550,11 @@ namespace Grand.Web.Admin.Controllers
var result = new List<CountryReportLineModel>();
foreach (var x in items)
{
- var country = await _countryService.GetCountryById(!String.IsNullOrEmpty(x.CountryId) ? x.CountryId : "");
+ var country = await _countryService.GetCountryById(!string.IsNullOrEmpty(x.CountryId) ? x.CountryId : "");
var m = new CountryReportLineModel {
CountryName = country != null ? country.Name : "Unknown",
SumOrders = _priceFormatter.FormatPrice(x.SumOrders, false),
- TotalOrders = x.TotalOrders,
+ TotalOrders = x.TotalOrders
};
result.Add(m);
}
@@ -576,12 +576,12 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> LowStockReportList(DataSourceRequest command)
{
- string vendorId = "";
+ var vendorId = "";
//a vendor should have access only to his products
if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
vendorId = _workContext.CurrentVendor.Id;
- string storeId = "";
+ var storeId = "";
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
storeId = _workContext.CurrentCustomer.StaffStoreId;
@@ -633,7 +633,7 @@ namespace Grand.Web.Admin.Controllers
var gridModel = new DataSourceResult {
Data = searchTermRecordLines.Select(x => new SearchTermReportLineModel {
Keyword = x.Keyword,
- Count = x.Count,
+ Count = x.Count
}),
Total = searchTermRecordLines.TotalCount
};
@@ -682,7 +682,7 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> ReportRegisteredCustomersList(DataSourceRequest command)
{
- string storeId = "";
+ var storeId = "";
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
storeId = _workContext.CurrentCustomer.StaffStoreId;
@@ -698,7 +698,7 @@ namespace Grand.Web.Admin.Controllers
[HttpPost]
public async Task<IActionResult> ReportCustomerTimeChart(DataSourceRequest command, DateTime? startDate, DateTime? endDate)
{
- string storeId = "";
+ var storeId = "";
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
storeId = _workContext.CurrentCustomer.StaffStoreId;
diff --git a/src/Web/Grand.Web.Admin/Controllers/SalesEmployeeController.cs b/src/Web/Grand.Web.Admin/Controllers/SalesEmployeeController.cs
index a24bb32d9..e05e961bc 100644
--- a/src/Web/Grand.Web.Admin/Controllers/SalesEmployeeController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/SalesEmployeeController.cs
@@ -8,15 +8,15 @@ using Grand.Web.Common.DataSource;
using Grand.Web.Common.Extensions;
using Grand.Web.Common.Security.Authorization;
using Grand.Domain.Customers;
-using Grand.Web.Admin.Extensions;
using Grand.Web.Admin.Models.Customers;
using Microsoft.AspNetCore.Mvc;
using Grand.Infrastructure;
+using Grand.Web.Admin.Extensions.Mapping;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.SalesEmployees)]
- public partial class SalesEmployeeController : BaseAdminController
+ public class SalesEmployeeController : BaseAdminController
{
#region Fields
diff --git a/src/Web/Grand.Web.Admin/Controllers/ScheduleTaskController.cs b/src/Web/Grand.Web.Admin/Controllers/ScheduleTaskController.cs
index 2f40bb99f..3424ad96f 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ScheduleTaskController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ScheduleTaskController.cs
@@ -16,7 +16,7 @@ using Microsoft.Extensions.DependencyInjection;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.ScheduleTasks)]
- public partial class ScheduleTaskController : BaseAdminController
+ public class ScheduleTaskController : BaseAdminController
{
#region Fields
@@ -54,7 +54,7 @@ namespace Grand.Web.Admin.Controllers
{
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.Select"), Value = "" });
foreach (var s in await _storeService.GetAllStores())
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
return model;
}
@@ -147,7 +147,7 @@ namespace Grand.Web.Admin.Controllers
else
{
- Error($"Task {typeofTask.Name} has not been registered");
+ Error($"Task {typeofTask?.Name} has not been registered");
}
}
catch (Exception exc)
diff --git a/src/Web/Grand.Web.Admin/Controllers/SearchController.cs b/src/Web/Grand.Web.Admin/Controllers/SearchController.cs
index 29e3c37c2..9bee9b197 100644
--- a/src/Web/Grand.Web.Admin/Controllers/SearchController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/SearchController.cs
@@ -79,9 +79,9 @@ namespace Grand.Web.Admin.Controllers
if (searchTerm.Length >= _adminSearchSettings.MinSearchTermLength)
{
- if (result.Count() < _adminSearchSettings.MaxSearchResultsCount && _adminSearchSettings.SearchInProducts)
+ if (result.Count < _adminSearchSettings.MaxSearchResultsCount && _adminSearchSettings.SearchInProducts)
{
- var products = (await _productService.SearchProducts(keywords: searchTerm, pageSize: _adminSearchSettings.MaxSearchResultsCount - result.Count(), showHidden: true)).products;
+ var products = (await _productService.SearchProducts(keywords: searchTerm, pageSize: _adminSearchSettings.MaxSearchResultsCount - result.Count, showHidden: true)).products;
foreach (var product in products)
{
result.Add(new Tuple<object, int>(new
@@ -93,9 +93,9 @@ namespace Grand.Web.Admin.Controllers
}
}
- if (result.Count() < _adminSearchSettings.MaxSearchResultsCount && _adminSearchSettings.SearchInCategories)
+ if (result.Count < _adminSearchSettings.MaxSearchResultsCount && _adminSearchSettings.SearchInCategories)
{
- var categories = await _categoryService.GetAllCategories(categoryName: searchTerm, pageSize: _adminSearchSettings.MaxSearchResultsCount - result.Count(), showHidden:
+ var categories = await _categoryService.GetAllCategories(categoryName: searchTerm, pageSize: _adminSearchSettings.MaxSearchResultsCount - result.Count, showHidden:
await _groupService.IsAdmin(_workContext.CurrentCustomer));
foreach (var category in categories)
{
@@ -108,9 +108,9 @@ namespace Grand.Web.Admin.Controllers
}
}
- if (result.Count() < _adminSearchSettings.MaxSearchResultsCount && _adminSearchSettings.SearchInCollections)
+ if (result.Count < _adminSearchSettings.MaxSearchResultsCount && _adminSearchSettings.SearchInCollections)
{
- var collections = await _collectionService.GetAllCollections(searchTerm, pageSize: _adminSearchSettings.MaxSearchResultsCount - result.Count(), showHidden: true);
+ var collections = await _collectionService.GetAllCollections(searchTerm, pageSize: _adminSearchSettings.MaxSearchResultsCount - result.Count, showHidden: true);
foreach (var collection in collections)
{
result.Add(new Tuple<object, int>(new
@@ -122,7 +122,7 @@ namespace Grand.Web.Admin.Controllers
}
}
- if (result.Count() < _adminSearchSettings.MaxSearchResultsCount && _adminSearchSettings.SearchInPages)
+ if (result.Count < _adminSearchSettings.MaxSearchResultsCount && _adminSearchSettings.SearchInPages)
{
var pages = (await _pageService.GetAllPages("")).Where(x => (x.SystemName != null && x.SystemName.ToLower().Contains(searchTerm.ToLower())) ||
(x.Title != null && x.Title.ToLower().Contains(searchTerm.ToLower())));
@@ -137,9 +137,9 @@ namespace Grand.Web.Admin.Controllers
}
}
- if (result.Count() < _adminSearchSettings.MaxSearchResultsCount && _adminSearchSettings.SearchInNews)
+ if (result.Count < _adminSearchSettings.MaxSearchResultsCount && _adminSearchSettings.SearchInNews)
{
- var news = await _newsService.GetAllNews(newsTitle: searchTerm, pageSize: _adminSearchSettings.MaxSearchResultsCount - result.Count(), showHidden: true);
+ var news = await _newsService.GetAllNews(newsTitle: searchTerm, pageSize: _adminSearchSettings.MaxSearchResultsCount - result.Count, showHidden: true);
foreach (var signleNews in news)
{
result.Add(new Tuple<object, int>(new
@@ -151,9 +151,9 @@ namespace Grand.Web.Admin.Controllers
}
}
- if (result.Count() < _adminSearchSettings.MaxSearchResultsCount && _adminSearchSettings.SearchInBlogs)
+ if (result.Count < _adminSearchSettings.MaxSearchResultsCount && _adminSearchSettings.SearchInBlogs)
{
- var blogPosts = await _blogService.GetAllBlogPosts(blogPostName: searchTerm, pageSize: _adminSearchSettings.MaxSearchResultsCount - result.Count(), showHidden: true);
+ var blogPosts = await _blogService.GetAllBlogPosts(blogPostName: searchTerm, pageSize: _adminSearchSettings.MaxSearchResultsCount - result.Count, showHidden: true);
foreach (var blogPost in blogPosts)
{
result.Add(new Tuple<object, int>(new
@@ -165,14 +165,14 @@ namespace Grand.Web.Admin.Controllers
}
}
- if (result.Count() < _adminSearchSettings.MaxSearchResultsCount && _adminSearchSettings.SearchInCustomers)
+ if (result.Count < _adminSearchSettings.MaxSearchResultsCount && _adminSearchSettings.SearchInCustomers)
{
- var customersByEmail = await _customerService.GetAllCustomers(email: searchTerm, pageSize: _adminSearchSettings.MaxSearchResultsCount - result.Count());
+ var customersByEmail = await _customerService.GetAllCustomers(email: searchTerm, pageSize: _adminSearchSettings.MaxSearchResultsCount - result.Count);
IPagedList<Customer> customersByUsername = new PagedList<Customer>();
- if (_adminSearchSettings.MaxSearchResultsCount - result.Count() - customersByEmail.Count() > 0)
+ if (_adminSearchSettings.MaxSearchResultsCount - result.Count - customersByEmail.Count > 0)
{
customersByUsername = await _customerService.GetAllCustomers(username: searchTerm, pageSize: _adminSearchSettings.MaxSearchResultsCount
- - result.Count() - customersByEmail.Count());
+ - result.Count - customersByEmail.Count);
}
var combined = customersByEmail.Union(customersByUsername).GroupBy(x => x.Email).Select(x => x.First());
@@ -187,14 +187,14 @@ namespace Grand.Web.Admin.Controllers
}
}
- if (result.Count() < _adminSearchSettings.MaxSearchResultsCount && _adminSearchSettings.SearchInMenu && foundMenuItems != null && foundMenuItems.Any())
+ if (result.Count < _adminSearchSettings.MaxSearchResultsCount && _adminSearchSettings.SearchInMenu && foundMenuItems != null && foundMenuItems.Any())
{
foreach (var menuItem in foundMenuItems)
{
- if (result.Count() >= _adminSearchSettings.MaxSearchResultsCount)
+ if (result.Count >= _adminSearchSettings.MaxSearchResultsCount)
break;
- string formatted = _translationService.GetResource("Admin.AdminSearch.Menu") + " > ";
+ var formatted = _translationService.GetResource("Admin.AdminSearch.Menu") + " > ";
if (string.IsNullOrEmpty(menuItem.grandParent))
{
formatted += menuItem.parent;
@@ -206,17 +206,17 @@ namespace Grand.Web.Admin.Controllers
result.Add(new Tuple<object, int>(new
{
- title = menuItem.title,
- link = menuItem.link,
+ menuItem.title,
+ menuItem.link,
source = formatted
}, _adminSearchSettings.MenuDisplayOrder));
}
}
}
- if (result.Count() < _adminSearchSettings.MaxSearchResultsCount && _adminSearchSettings.SearchInOrders)
+ if (result.Count < _adminSearchSettings.MaxSearchResultsCount && _adminSearchSettings.SearchInOrders)
{
- int.TryParse(searchTerm, out int orderNumber);
+ int.TryParse(searchTerm, out var orderNumber);
if (orderNumber > 0)
{
var order = await _orderService.GetOrderByNumber(orderNumber);
@@ -251,9 +251,9 @@ namespace Grand.Web.Admin.Controllers
[HttpGet]
public async Task<IActionResult> Category(string categoryId)
{
- string value = HttpContext.Request.Query["filter[filters][0][value]"].ToString();
+ var value = HttpContext.Request.Query["filter[filters][0][value]"].ToString();
- async Task<IList<SearchModel>> PrepareModel(IList<Category> categories)
+ async Task<IList<SearchModel>> PrepareModel(IEnumerable<Category> categories)
{
var model = new List<SearchModel>();
if (!string.IsNullOrEmpty(categoryId))
@@ -261,33 +261,31 @@ namespace Grand.Web.Admin.Controllers
var currentCategory = await _categoryService.GetCategoryById(categoryId);
if (currentCategory != null)
{
- model.Add(new SearchModel()
- {
+ model.Add(new SearchModel {
Id = currentCategory.Id,
- Name = await _categoryService.GetFormattedBreadCrumb(currentCategory),
+ Name = await _categoryService.GetFormattedBreadCrumb(currentCategory)
});
}
}
foreach (var item in categories)
{
if (item.Id != categoryId)
- model.Add(new SearchModel()
- {
+ model.Add(new SearchModel {
Id = item.Id,
- Name = await _categoryService.GetFormattedBreadCrumb(item),
+ Name = await _categoryService.GetFormattedBreadCrumb(item)
});
}
return model;
}
var storeId = _workContext.CurrentCustomer.StaffStoreId;
- var categories = (await _categoryService.GetAllCategories(
- storeId: storeId,
- categoryName: value,
- pageSize: _adminSearchSettings.CategorySizeLimit));
+ var categories = await _categoryService.GetAllCategories(
+ storeId: storeId,
+ categoryName: value,
+ pageSize: _adminSearchSettings.CategorySizeLimit);
var gridModel = new DataSourceResult
{
- Data = await PrepareModel(categories),
+ Data = await PrepareModel(categories)
};
return Json(gridModel);
}
@@ -295,9 +293,9 @@ namespace Grand.Web.Admin.Controllers
[HttpGet]
public async Task<IActionResult> Collection(string collectionId)
{
- string value = HttpContext.Request.Query["filter[filters][0][value]"].ToString();
+ var value = HttpContext.Request.Query["filter[filters][0][value]"].ToString();
- async Task<IList<SearchModel>> PrepareModel(IList<Collection> collections)
+ async Task<IList<SearchModel>> PrepareModel(IEnumerable<Collection> collections)
{
var model = new List<SearchModel>();
if (!string.IsNullOrEmpty(collectionId))
@@ -305,20 +303,18 @@ namespace Grand.Web.Admin.Controllers
var currentCollection = await _collectionService.GetCollectionById(collectionId);
if (currentCollection != null)
{
- model.Add(new SearchModel()
- {
+ model.Add(new SearchModel {
Id = currentCollection.Id,
- Name = currentCollection.Name,
+ Name = currentCollection.Name
});
}
}
foreach (var item in collections)
{
if (item.Id != collectionId)
- model.Add(new SearchModel()
- {
+ model.Add(new SearchModel {
Id = item.Id,
- Name = item.Name,
+ Name = item.Name
});
}
return model;
@@ -326,14 +322,14 @@ namespace Grand.Web.Admin.Controllers
var storeId = _workContext.CurrentCustomer.StaffStoreId;
- var collections = (await _collectionService.GetAllCollections(
- storeId: storeId,
- collectionName: value,
- pageSize: _adminSearchSettings.CollectionSizeLimit));
+ var collections = await _collectionService.GetAllCollections(
+ storeId: storeId,
+ collectionName: value,
+ pageSize: _adminSearchSettings.CollectionSizeLimit);
var gridModel = new DataSourceResult
{
- Data = await PrepareModel(collections),
+ Data = await PrepareModel(collections)
};
return Json(gridModel);
}
@@ -341,9 +337,9 @@ namespace Grand.Web.Admin.Controllers
[HttpGet]
public async Task<IActionResult> CustomerGroup(string[] customerGroups)
{
- string value = HttpContext.Request.Query["filter[filters][0][value]"].ToString();
+ var value = HttpContext.Request.Query["filter[filters][0][value]"].ToString();
- async Task<IList<SearchModel>> PrepareModel(IList<CustomerGroup> groups)
+ async Task<IList<SearchModel>> PrepareModel(IEnumerable<CustomerGroup> groups)
{
var model = new List<SearchModel>();
if (customerGroups != null && customerGroups.Any())
@@ -351,10 +347,9 @@ namespace Grand.Web.Admin.Controllers
var currentGroups = await _groupService.GetAllByIds(customerGroups);
foreach (var item in currentGroups)
{
- model.Add(new SearchModel()
- {
+ model.Add(new SearchModel {
Id = item.Id,
- Name = item.Name,
+ Name = item.Name
});
}
@@ -363,23 +358,22 @@ namespace Grand.Web.Admin.Controllers
{
if (model.FirstOrDefault(x => x.Id == item.Id) == null)
{
- model.Add(new SearchModel()
- {
+ model.Add(new SearchModel {
Id = item.Id,
- Name = item.Name,
+ Name = item.Name
});
}
}
return model;
}
- var groups = (await _groupService.GetAllCustomerGroups(
- name: value,
- pageSize: _adminSearchSettings.CustomerGroupSizeLimit));
+ var groups = await _groupService.GetAllCustomerGroups(
+ name: value,
+ pageSize: _adminSearchSettings.CustomerGroupSizeLimit);
var gridModel = new DataSourceResult
{
- Data = await PrepareModel(groups),
+ Data = await PrepareModel(groups)
};
return Json(gridModel);
}
@@ -387,9 +381,7 @@ namespace Grand.Web.Admin.Controllers
[HttpGet]
public async Task<IActionResult> Stores(string[] stores)
{
- string value = HttpContext.Request.Query["filter[filters][0][value]"].ToString();
-
- async Task<IList<SearchModel>> PrepareModel(IList<Store> groups)
+ async Task<IList<SearchModel>> PrepareModel(IEnumerable<Store> groups)
{
var model = new List<SearchModel>();
if (stores != null && stores.Any())
@@ -398,10 +390,9 @@ namespace Grand.Web.Admin.Controllers
{
var currentStore = await _storeService.GetStoreById(item);
if (currentStore != null)
- model.Add(new SearchModel()
- {
+ model.Add(new SearchModel {
Id = currentStore.Id,
- Name = currentStore.Name,
+ Name = currentStore.Name
});
}
@@ -410,10 +401,9 @@ namespace Grand.Web.Admin.Controllers
{
if (model.FirstOrDefault(x => x.Id == item.Id) == null)
{
- model.Add(new SearchModel()
- {
+ model.Add(new SearchModel {
Id = item.Id,
- Name = item.Name,
+ Name = item.Name
});
}
}
@@ -427,7 +417,7 @@ namespace Grand.Web.Admin.Controllers
var gridModel = new DataSourceResult
{
- Data = await PrepareModel(groups),
+ Data = await PrepareModel(groups)
};
return Json(gridModel);
}
@@ -435,9 +425,9 @@ namespace Grand.Web.Admin.Controllers
[HttpGet]
public async Task<IActionResult> Vendor(string vendorId)
{
- string value = HttpContext.Request.Query["filter[filters][0][value]"].ToString();
+ var value = HttpContext.Request.Query["filter[filters][0][value]"].ToString();
- async Task<IList<SearchModel>> PrepareModel(IList<Vendor> vendors)
+ async Task<IList<SearchModel>> PrepareModel(IEnumerable<Vendor> vendors)
{
var model = new List<SearchModel>();
if (!string.IsNullOrEmpty(vendorId))
@@ -445,39 +435,37 @@ namespace Grand.Web.Admin.Controllers
var currentVendor = await _vendorService.GetVendorById(vendorId);
if (currentVendor != null)
{
- model.Add(new SearchModel()
- {
+ model.Add(new SearchModel {
Id = currentVendor.Id,
- Name = currentVendor.Name,
+ Name = currentVendor.Name
});
}
}
foreach (var item in vendors)
{
if (item.Id != vendorId)
- model.Add(new SearchModel()
- {
+ model.Add(new SearchModel {
Id = item.Id,
- Name = item.Name,
+ Name = item.Name
});
}
return model;
}
- var vendors = (await _vendorService.GetAllVendors(
- name: value,
- pageSize: _adminSearchSettings.VendorSizeLimit, showHidden: true));
+ var vendors = await _vendorService.GetAllVendors(
+ name: value,
+ pageSize: _adminSearchSettings.VendorSizeLimit, showHidden: true);
var gridModel = new DataSourceResult
{
- Data = await PrepareModel(vendors),
+ Data = await PrepareModel(vendors)
};
return Json(gridModel);
}
[HttpGet]
public async Task<IActionResult> Brand(string brandId)
{
- string value = HttpContext.Request.Query["filter[filters][0][value]"].ToString();
+ var value = HttpContext.Request.Query["filter[filters][0][value]"].ToString();
- async Task<IList<SearchModel>> PrepareModel(IList<Brand> brands)
+ async Task<IList<SearchModel>> PrepareModel(IEnumerable<Brand> brands)
{
var model = new List<SearchModel>();
if (!string.IsNullOrEmpty(brandId))
@@ -485,30 +473,28 @@ namespace Grand.Web.Admin.Controllers
var currentBrand = await _brandService.GetBrandById(brandId);
if (currentBrand != null)
{
- model.Add(new SearchModel()
- {
+ model.Add(new SearchModel {
Id = currentBrand.Id,
- Name = currentBrand.Name,
+ Name = currentBrand.Name
});
}
}
foreach (var item in brands)
{
if (item.Id != brandId)
- model.Add(new SearchModel()
- {
+ model.Add(new SearchModel {
Id = item.Id,
- Name = item.Name,
+ Name = item.Name
});
}
return model;
}
- var brands = (await _brandService.GetAllBrands(
- brandName: value,
- pageSize: _adminSearchSettings.BrandSizeLimit));
+ var brands = await _brandService.GetAllBrands(
+ brandName: value,
+ pageSize: _adminSearchSettings.BrandSizeLimit);
var gridModel = new DataSourceResult
{
- Data = await PrepareModel(brands),
+ Data = await PrepareModel(brands)
};
return Json(gridModel);
}
diff --git a/src/Web/Grand.Web.Admin/Controllers/SettingController.cs b/src/Web/Grand.Web.Admin/Controllers/SettingController.cs
index 4b970aa51..fb6dea8b6 100644
--- a/src/Web/Grand.Web.Admin/Controllers/SettingController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/SettingController.cs
@@ -27,7 +27,8 @@ using Grand.Domain.Vendors;
using Grand.Infrastructure;
using Grand.Infrastructure.Caching;
using Grand.SharedKernel.Extensions;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
+using Grand.Web.Admin.Extensions.Mapping.Settings;
using Grand.Web.Admin.Models.Settings;
using Grand.Web.Common.DataSource;
using Grand.Web.Common.Extensions;
@@ -36,14 +37,13 @@ using Grand.Web.Common.Security.Authorization;
using Grand.Web.Common.Security.Captcha;
using Grand.Web.Common.Themes;
using MediatR;
-using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Settings)]
- public partial class SettingController : BaseAdminController
+ public class SettingController : BaseAdminController
{
#region Fields
@@ -110,13 +110,13 @@ namespace Grand.Web.Admin.Controllers
var blogSettings = _settingService.LoadSetting<BlogSettings>(storeScope);
var newsSettings = _settingService.LoadSetting<NewsSettings>(storeScope);
var knowledgebaseSettings = _settingService.LoadSetting<KnowledgebaseSettings>(storeScope);
- var model = new ContentSettingsModel() {
+ var model = new ContentSettingsModel {
BlogSettings = blogSettings.ToModel(),
NewsSettings = newsSettings.ToModel(),
- KnowledgebaseSettings = knowledgebaseSettings.ToModel()
+ KnowledgebaseSettings = knowledgebaseSettings.ToModel(),
+ ActiveStore = storeScope
};
- model.ActiveStore = storeScope;
return View(model);
}
@@ -232,11 +232,11 @@ namespace Grand.Web.Admin.Controllers
var model = new List<SortOptionModel>();
foreach (int option in Enum.GetValues(typeof(ProductSortingEnum)))
{
- model.Add(new SortOptionModel() {
+ model.Add(new SortOptionModel {
Id = option,
Name = ((ProductSortingEnum)option).GetTranslationEnum(_translationService, _workContext),
IsActive = !catalogSettings.ProductSortingEnumDisabled.Contains(option),
- DisplayOrder = catalogSettings.ProductSortingEnumDisplayOrder.TryGetValue(option, out int value) ? value : option
+ DisplayOrder = catalogSettings.ProductSortingEnumDisplayOrder.TryGetValue(option, out var value) ? value : option
});
}
var gridModel = new DataSourceResult {
@@ -275,27 +275,27 @@ namespace Grand.Web.Admin.Controllers
var orderSettings = _settingService.LoadSetting<OrderSettings>(storeScope);
var shoppingCartSettings = _settingService.LoadSetting<ShoppingCartSettings>(storeScope);
- var model = new SalesSettingsModel() {
+ var model = new SalesSettingsModel {
LoyaltyPointsSettings = loyaltyPointsSettings.ToModel(),
OrderSettings = orderSettings.ToModel(),
ShoppingCartSettings = shoppingCartSettings.ToModel(),
ActiveStore = storeScope
};
- var currencySettings = _settingService.LoadSetting<CurrencySettings>("");
+ var currencySettings = _settingService.LoadSetting<CurrencySettings>();
var currency = await _currencyService.GetCurrencyById(currencySettings.PrimaryStoreCurrencyId);
//loyal
model.LoyaltyPointsSettings.PrimaryStoreCurrencyCode = currency?.CurrencyCode;
//order statuses
var status = await _orderStatusService.GetAll();
- model.LoyaltyPointsSettings.PointsForPurchases_Awarded_OrderStatuses = status.Select(x => new SelectListItem() { Value = x.StatusId.ToString(), Text = x.Name }).ToList();
+ model.LoyaltyPointsSettings.PointsForPurchases_Awarded_OrderStatuses = status.Select(x => new SelectListItem { Value = x.StatusId.ToString(), Text = x.Name }).ToList();
//orders
model.OrderSettings.PrimaryStoreCurrencyCode = currency?.CurrencyCode;
//gift voucher activation
- model.OrderSettings.GiftVouchers_Activated_OrderStatuses = status.Select(x => new SelectListItem() { Value = x.StatusId.ToString(), Text = x.Name }).ToList();
+ model.OrderSettings.GiftVouchers_Activated_OrderStatuses = status.Select(x => new SelectListItem { Value = x.StatusId.ToString(), Text = x.Name }).ToList();
model.OrderSettings.GiftVouchers_Activated_OrderStatuses.Insert(0, new SelectListItem { Text = "---", Value = "0" });
return View(model);
@@ -666,7 +666,7 @@ namespace Grand.Web.Admin.Controllers
model.SecuritySettings = captchaSettings.ToModel();
if (securitySettings.AdminAreaAllowedIpAddresses != null)
- for (int i = 0; i < securitySettings.AdminAreaAllowedIpAddresses.Count; i++)
+ for (var i = 0; i < securitySettings.AdminAreaAllowedIpAddresses.Count; i++)
{
model.SecuritySettings.AdminAreaAllowedIpAddresses += securitySettings.AdminAreaAllowedIpAddresses[i];
if (i != securitySettings.AdminAreaAllowedIpAddresses.Count - 1)
@@ -679,10 +679,6 @@ namespace Grand.Web.Admin.Controllers
var pdfSettings = _settingService.LoadSetting<PdfSettings>(storeScope);
model.PdfSettings = pdfSettings.ToModel();
- //google analytics
- var googleAnalyticsSettings = _settingService.LoadSetting<GoogleAnalyticsSettings>(storeScope);
- model.GoogleAnalyticsSettings = googleAnalyticsSettings.ToModel();
-
//display menu settings
var displayMenuItemSettings = _settingService.LoadSetting<MenuItemSettings>(storeScope);
model.DisplayMenuSettings = displayMenuItemSettings.ToModel();
@@ -744,12 +740,7 @@ namespace Grand.Web.Admin.Controllers
var pdfSettings = _settingService.LoadSetting<PdfSettings>(storeScope);
pdfSettings = model.PdfSettings.ToEntity(pdfSettings);
await _settingService.SaveSetting(pdfSettings, storeScope);
-
- //googleanalytics settings
- var googleAnalyticsSettings = _settingService.LoadSetting<GoogleAnalyticsSettings>(storeScope);
- googleAnalyticsSettings = model.GoogleAnalyticsSettings.ToEntity(googleAnalyticsSettings);
- await _settingService.SaveSetting(googleAnalyticsSettings, storeScope);
-
+
//menu item settings
var displayMenuItemSettings = _settingService.LoadSetting<MenuItemSettings>(storeScope);
displayMenuItemSettings = model.DisplayMenuSettings.ToEntity(displayMenuItemSettings);
@@ -807,8 +798,8 @@ namespace Grand.Web.Admin.Controllers
var savedFilePath = CommonPath.WebMapPath(filename);
if (System.IO.File.Exists(oryginalFilePath))
{
- string[] lines = System.IO.File.ReadAllLines(oryginalFilePath);
- int i = 0;
+ var lines = System.IO.File.ReadAllLines(oryginalFilePath);
+ var i = 0;
foreach (var line in lines)
{
if (line.Contains("apiKey"))
@@ -917,9 +908,9 @@ namespace Grand.Web.Admin.Controllers
await _settingService.SaveSetting(settings);
//order ident
- if (model.OrderIdent.HasValue && model.OrderIdent.Value > 0)
+ if (model.OrderIdent is > 0)
{
- await _mediator.Send(new MaxOrderNumberCommand() { OrderNumber = model.OrderIdent });
+ await _mediator.Send(new MaxOrderNumberCommand { OrderNumber = model.OrderIdent });
}
//admin area
@@ -977,7 +968,7 @@ namespace Grand.Web.Admin.Controllers
private async Task SavePictureStorage(bool storeIdDb)
{
- int pageIndex = 0;
+ var pageIndex = 0;
const int pageSize = 100;
try
{
diff --git a/src/Web/Grand.Web.Admin/Controllers/ShipmentController.cs b/src/Web/Grand.Web.Admin/Controllers/ShipmentController.cs
index 65594dc7a..b7a5063fb 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ShipmentController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ShipmentController.cs
@@ -9,6 +9,7 @@ using Grand.Domain.Orders;
using Grand.Domain.Shipping;
using Grand.Infrastructure;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Orders;
using Grand.Web.Common.DataSource;
@@ -21,7 +22,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Shipments)]
- public partial class ShipmentController : BaseAdminController
+ public class ShipmentController : BaseAdminController
{
#region Fields
private readonly IShipmentViewModelService _shipmentViewModelService;
@@ -223,7 +224,7 @@ namespace Grand.Web.Admin.Controllers
if (!valid)
{
Error(message);
- return RedirectToAction("AddShipment", new { orderId = orderId });
+ return RedirectToAction("AddShipment", new { orderId });
}
//if we have at least one item in the shipment, then save it
if (shipment != null && shipment.ShipmentItems.Count > 0)
@@ -237,7 +238,7 @@ namespace Grand.Web.Admin.Controllers
Note = $"A shipment #{shipment.ShipmentNumber} has been added",
DisplayToCustomer = false,
CreatedOnUtc = DateTime.UtcNow,
- OrderId = order.Id,
+ OrderId = order.Id
});
_ = _shipmentViewModelService.LogShipment(shipment.Id, $"A shipment #{shipment.ShipmentNumber} has been added");
@@ -249,7 +250,7 @@ namespace Grand.Web.Admin.Controllers
}
Error(_translationService.GetResource("Admin.Orders.Shipments.NoProductsSelected"));
- return RedirectToAction("AddShipment", new { orderId = orderId });
+ return RedirectToAction("AddShipment", new { orderId });
}
[PermissionAuthorizeAction(PermissionActionName.Preview)]
@@ -318,14 +319,14 @@ namespace Grand.Web.Admin.Controllers
Note = $"A shipment #{shipment.ShipmentNumber} has been deleted",
DisplayToCustomer = false,
CreatedOnUtc = DateTime.UtcNow,
- OrderId = order.Id,
+ OrderId = order.Id
});
_ = _shipmentViewModelService.LogShipment(shipment.Id, $"A shipment #{shipment.ShipmentNumber} has been deleted");
Success(_translationService.GetResource("Admin.Orders.Shipments.Deleted"));
- return RedirectToAction("Edit", "Order", new { Id = order.Id });
+ return RedirectToAction("Edit", "Order", new { order.Id });
}
[PermissionAuthorizeAction(PermissionActionName.Edit)]
@@ -426,13 +427,13 @@ namespace Grand.Web.Admin.Controllers
try
{
- await _mediator.Send(new ShipCommand() { Shipment = shipment, NotifyCustomer = true });
+ await _mediator.Send(new ShipCommand { Shipment = shipment, NotifyCustomer = true });
return RedirectToAction("ShipmentDetails", new { id = shipment.Id });
}
catch (Exception exc)
{
//error
- Error(exc, true);
+ Error(exc);
return RedirectToAction("ShipmentDetails", new { id = shipment.Id });
}
}
@@ -478,7 +479,7 @@ namespace Grand.Web.Admin.Controllers
catch (Exception exc)
{
//error
- Error(exc, true);
+ Error(exc);
return RedirectToAction("ShipmentDetails", new { id = shipment.Id });
}
}
@@ -513,13 +514,13 @@ namespace Grand.Web.Admin.Controllers
try
{
- await _mediator.Send(new DeliveryCommand() { Shipment = shipment, NotifyCustomer = true });
+ await _mediator.Send(new DeliveryCommand { Shipment = shipment, NotifyCustomer = true });
return RedirectToAction("ShipmentDetails", new { id = shipment.Id });
}
catch (Exception exc)
{
//error
- Error(exc, true);
+ Error(exc);
return RedirectToAction("ShipmentDetails", new { id = shipment.Id });
}
}
@@ -567,7 +568,7 @@ namespace Grand.Web.Admin.Controllers
catch (Exception exc)
{
//error
- Error(exc, true);
+ Error(exc);
return RedirectToAction("ShipmentDetails", new { id = shipment.Id });
}
}
@@ -637,7 +638,7 @@ namespace Grand.Web.Admin.Controllers
await _pdfService.PrintPackagingSlipsToPdf(stream, shipments, _workContext.WorkingLanguage.Id);
bytes = stream.ToArray();
}
- return File(bytes, "application/pdf", string.Format("packagingslip_{0}.pdf", shipment.Id));
+ return File(bytes, "application/pdf", $"packagingslip_{shipment.Id}.pdf");
}
[PermissionAuthorizeAction(PermissionActionName.Export)]
@@ -756,7 +757,7 @@ namespace Grand.Web.Admin.Controllers
{
try
{
- await _mediator.Send(new ShipCommand() { Shipment = shipment, NotifyCustomer = true });
+ await _mediator.Send(new ShipCommand { Shipment = shipment, NotifyCustomer = true });
}
catch
{
@@ -801,7 +802,7 @@ namespace Grand.Web.Admin.Controllers
{
try
{
- await _mediator.Send(new DeliveryCommand() { Shipment = shipment, NotifyCustomer = true });
+ await _mediator.Send(new DeliveryCommand { Shipment = shipment, NotifyCustomer = true });
}
catch
{
diff --git a/src/Web/Grand.Web.Admin/Controllers/ShippingController.cs b/src/Web/Grand.Web.Admin/Controllers/ShippingController.cs
index 49f614237..deb976375 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ShippingController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ShippingController.cs
@@ -12,7 +12,6 @@ using Grand.Web.Common.Security.Authorization;
using Grand.Domain.Directory;
using Grand.Domain.Shipping;
using Grand.Infrastructure;
-using Grand.Web.Admin.Extensions;
using Grand.Web.Admin.Models.Directory;
using Grand.Web.Admin.Models.Shipping;
using Microsoft.AspNetCore.Http;
@@ -20,11 +19,13 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Grand.Web.Admin.Models.Common;
using Grand.Business.Core.Interfaces.Common.Logging;
+using Grand.Web.Admin.Extensions.Mapping;
+using Grand.Web.Admin.Extensions.Mapping.Settings;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.ShippingSettings)]
- public partial class ShippingController : BaseAdminController
+ public class ShippingController : BaseAdminController
{
#region Fields
@@ -83,13 +84,13 @@ namespace Grand.Web.Admin.Controllers
{
model.Address.AvailableCountries.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Address.SelectCountry"), Value = "" });
foreach (var c in await _countryService.GetAllCountries(showHidden: true))
- model.Address.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id.ToString(), Selected = (c.Id == model.Address.CountryId) });
+ model.Address.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id, Selected = c.Id == model.Address.CountryId });
//states
- var states = !String.IsNullOrEmpty(model.Address.CountryId) ? (await _countryService.GetCountryById(model.Address.CountryId))?.StateProvinces : new List<StateProvince>();
- if (states.Count > 0)
+ var states = !string.IsNullOrEmpty(model.Address.CountryId) ? (await _countryService.GetCountryById(model.Address.CountryId))?.StateProvinces : new List<StateProvince>();
+ if (states?.Count > 0)
{
foreach (var s in states)
- model.Address.AvailableStates.Add(new SelectListItem { Text = s.Name, Value = s.Id.ToString(), Selected = (s.Id == model.Address.StateProvinceId) });
+ model.Address.AvailableStates.Add(new SelectListItem { Text = s.Name, Value = s.Id, Selected = s.Id == model.Address.StateProvinceId });
}
model.Address.CountryEnabled = true;
@@ -107,13 +108,13 @@ namespace Grand.Web.Admin.Controllers
{
model.Address.AvailableCountries.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Address.SelectCountry"), Value = "" });
foreach (var c in await _countryService.GetAllCountries(showHidden: true))
- model.Address.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id.ToString(), Selected = (c.Id == model.Address.CountryId) });
+ model.Address.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id, Selected = c.Id == model.Address.CountryId });
//states
- var states = !String.IsNullOrEmpty(model.Address.CountryId) ? (await _countryService.GetCountryById(model.Address.CountryId))?.StateProvinces : new List<StateProvince>();
- if (states.Count > 0)
+ var states = !string.IsNullOrEmpty(model.Address.CountryId) ? (await _countryService.GetCountryById(model.Address.CountryId))?.StateProvinces : new List<StateProvince>();
+ if (states?.Count > 0)
{
foreach (var s in states)
- model.Address.AvailableStates.Add(new SelectListItem { Text = s.Name, Value = s.Id.ToString(), Selected = (s.Id == model.Address.StateProvinceId) });
+ model.Address.AvailableStates.Add(new SelectListItem { Text = s.Name, Value = s.Id, Selected = s.Id == model.Address.StateProvinceId });
}
model.Address.CountryEnabled = true;
@@ -128,11 +129,11 @@ namespace Grand.Web.Admin.Controllers
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Configuration.Shipping.PickupPoint.SelectStore"), Value = "" });
foreach (var c in await _storeService.GetAllStores())
- model.AvailableStores.Add(new SelectListItem { Text = c.Shortcut, Value = c.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = c.Shortcut, Value = c.Id });
model.AvailableWarehouses.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Configuration.Shipping.PickupPoint.SelectWarehouse"), Value = "" });
foreach (var c in await _warehouseService.GetAllWarehouses())
- model.AvailableWarehouses.Add(new SelectListItem { Text = c.Name, Value = c.Id.ToString() });
+ model.AvailableWarehouses.Add(new SelectListItem { Text = c.Name, Value = c.Id });
}
@@ -160,7 +161,7 @@ namespace Grand.Web.Admin.Controllers
var gridModel = new DataSourceResult
{
Data = shippingProvidersModel,
- Total = shippingProvidersModel.Count()
+ Total = shippingProvidersModel.Count
};
return Json(gridModel);
@@ -316,13 +317,13 @@ namespace Grand.Web.Admin.Controllers
model.ShippingOriginAddress.AvailableCountries.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Address.SelectCountry"), Value = "" });
foreach (var c in await _countryService.GetAllCountries(showHidden: true))
- model.ShippingOriginAddress.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id.ToString(), Selected = (originAddress != null && c.Id == originAddress.CountryId) });
+ model.ShippingOriginAddress.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id, Selected = originAddress != null && c.Id == originAddress.CountryId });
- var states = originAddress != null && !String.IsNullOrEmpty(originAddress.CountryId) ? (await _countryService.GetCountryById(originAddress.CountryId))?.StateProvinces : new List<StateProvince>();
- if (states.Count > 0)
+ var states = originAddress != null && !string.IsNullOrEmpty(originAddress.CountryId) ? (await _countryService.GetCountryById(originAddress.CountryId))?.StateProvinces : new List<StateProvince>();
+ if (states?.Count > 0)
{
foreach (var s in states)
- model.ShippingOriginAddress.AvailableStates.Add(new SelectListItem { Text = s.Name, Value = s.Id.ToString(), Selected = (s.Id == originAddress.StateProvinceId) });
+ model.ShippingOriginAddress.AvailableStates.Add(new SelectListItem { Text = s.Name, Value = s.Id, Selected = s.Id == originAddress?.StateProvinceId });
}
model.ShippingOriginAddress.CountryEnabled = true;
@@ -411,7 +412,7 @@ namespace Grand.Web.Admin.Controllers
var model = deliveryDate.ToModel();
- if (String.IsNullOrEmpty(model.ColorSquaresRgb))
+ if (string.IsNullOrEmpty(model.ColorSquaresRgb))
{
model.ColorSquaresRgb = "#000000";
}
@@ -684,14 +685,14 @@ namespace Grand.Web.Admin.Controllers
}
foreach (var r in customerGroups)
{
- model.AvailableCustomerGroups.Add(new CustomerGroupModel() { Id = r.Id, Name = r.Name });
+ model.AvailableCustomerGroups.Add(new CustomerGroupModel { Id = r.Id, Name = r.Name });
}
foreach (var country in countries)
{
foreach (var shippingMethod in shippingMethods)
{
- bool restricted = shippingMethod.CountryRestrictionExists(country.Id);
+ var restricted = shippingMethod.CountryRestrictionExists(country.Id);
if (!model.Restricted.ContainsKey(country.Id))
model.Restricted[country.Id] = new Dictionary<string, bool>();
model.Restricted[country.Id][shippingMethod.Id] = restricted;
@@ -702,7 +703,7 @@ namespace Grand.Web.Admin.Controllers
{
foreach (var shippingMethod in shippingMethods)
{
- bool restricted = shippingMethod.CustomerGroupRestrictionExists(role.Id);
+ var restricted = shippingMethod.CustomerGroupRestrictionExists(role.Id);
if (!model.RestictedGroup.ContainsKey(role.Id))
model.RestictedGroup[role.Id] = new Dictionary<string, bool>();
model.RestictedGroup[role.Id][shippingMethod.Id] = restricted;
@@ -723,17 +724,15 @@ namespace Grand.Web.Admin.Controllers
foreach (var shippingMethod in shippingMethods)
{
- string formKey = "restrict_" + shippingMethod.Id;
- var countryIdsToRestrict = form[formKey].ToString() != null
- ? form[formKey].ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
+ var formKey = "restrict_" + shippingMethod.Id;
+ var countryIdsToRestrict = form[formKey].ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
.Select(x => x)
- .ToList()
- : new List<string>();
+ .ToList();
foreach (var country in countries)
{
- bool restrict = countryIdsToRestrict.Contains(country.Id);
+ var restrict = countryIdsToRestrict.Contains(country.Id);
if (restrict)
{
if (shippingMethod.RestrictedCountries.FirstOrDefault(c => c.Id == country.Id) == null)
@@ -753,17 +752,15 @@ namespace Grand.Web.Admin.Controllers
}
formKey = "restrictgroup_" + shippingMethod.Id;
- var roleIdsToRestrict = form[formKey].ToString() != null
- ? form[formKey].ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
+ var roleIdsToRestrict = form[formKey].ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
.Select(x => x)
- .ToList()
- : new List<string>();
+ .ToList();
foreach (var role in customerGroups)
{
- bool restrict = roleIdsToRestrict.Contains(role.Id);
+ var restrict = roleIdsToRestrict.Contains(role.Id);
if (restrict)
{
if (shippingMethod.RestrictedGroups.FirstOrDefault(c => c == role.Id) == null)
diff --git a/src/Web/Grand.Web.Admin/Controllers/ShoppingCartController.cs b/src/Web/Grand.Web.Admin/Controllers/ShoppingCartController.cs
index 40caa3d67..05a051121 100644
--- a/src/Web/Grand.Web.Admin/Controllers/ShoppingCartController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/ShoppingCartController.cs
@@ -15,7 +15,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.CurrentCarts)]
- public partial class ShoppingCartController : BaseAdminController
+ public class ShoppingCartController : BaseAdminController
{
#region Fields
diff --git a/src/Web/Grand.Web.Admin/Controllers/SpecificationAttributeController.cs b/src/Web/Grand.Web.Admin/Controllers/SpecificationAttributeController.cs
index 6288f61d1..418014894 100644
--- a/src/Web/Grand.Web.Admin/Controllers/SpecificationAttributeController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/SpecificationAttributeController.cs
@@ -10,14 +10,14 @@ using Grand.Web.Common.Filters;
using Grand.Web.Common.Security.Authorization;
using Grand.Domain.Seo;
using Grand.Infrastructure;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Models.Catalog;
using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.SpecificationAttributes)]
- public partial class SpecificationAttributeController : BaseAdminController
+ public class SpecificationAttributeController : BaseAdminController
{
#region Fields
@@ -100,7 +100,7 @@ namespace Grand.Web.Admin.Controllers
specificationAttribute.SeName = SeoExtensions.GetSeName(string.IsNullOrEmpty(specificationAttribute.SeName) ? specificationAttribute.Name : specificationAttribute.SeName, _seoSettings.ConvertNonWesternChars, _seoSettings.AllowUnicodeCharsInUrls, _seoSettings.SeoCharConversion);
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
- model.Stores = new string[] { _workContext.CurrentCustomer.StaffStoreId };
+ model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };
}
await _specificationAttributeService.InsertSpecificationAttribute(specificationAttribute);
//activity log
@@ -149,7 +149,7 @@ namespace Grand.Web.Admin.Controllers
specificationAttribute.SeName = SeoExtensions.GetSeName(string.IsNullOrEmpty(specificationAttribute.SeName) ? specificationAttribute.Name : specificationAttribute.SeName, _seoSettings.ConvertNonWesternChars, _seoSettings.AllowUnicodeCharsInUrls, _seoSettings.SeoCharConversion);
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
- model.Stores = new string[] { _workContext.CurrentCustomer.StaffStoreId };
+ model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };
}
await _specificationAttributeService.UpdateSpecificationAttribute(specificationAttribute);
//activity log
@@ -270,13 +270,13 @@ namespace Grand.Web.Admin.Controllers
[PermissionAuthorizeAction(PermissionActionName.Edit)]
public async Task<IActionResult> OptionEditPopup(string id)
{
- var sao = (await _specificationAttributeService.GetSpecificationAttributeByOptionId(id)).SpecificationAttributeOptions.Where(x => x.Id == id).FirstOrDefault();
+ var sao = (await _specificationAttributeService.GetSpecificationAttributeByOptionId(id)).SpecificationAttributeOptions.FirstOrDefault(x => x.Id == id);
if (sao == null)
//No specification attribute option found with the specified id
return RedirectToAction("List");
var model = sao.ToModel();
- model.EnableColorSquaresRgb = !String.IsNullOrEmpty(sao.ColorSquaresRgb);
+ model.EnableColorSquaresRgb = !string.IsNullOrEmpty(sao.ColorSquaresRgb);
//locales
await AddLocales(_languageService, model.Locales, (locale, languageId) =>
{
@@ -291,7 +291,7 @@ namespace Grand.Web.Admin.Controllers
public async Task<IActionResult> OptionEditPopup(SpecificationAttributeOptionModel model)
{
var specificationAttribute = await _specificationAttributeService.GetSpecificationAttributeByOptionId(model.Id);
- var sao = specificationAttribute.SpecificationAttributeOptions.Where(x => x.Id == model.Id).FirstOrDefault();
+ var sao = specificationAttribute.SpecificationAttributeOptions.FirstOrDefault(x => x.Id == model.Id);
if (sao == null)
//No specification attribute option found with the specified id
return RedirectToAction("List");
@@ -321,7 +321,7 @@ namespace Grand.Web.Admin.Controllers
if (ModelState.IsValid)
{
var specificationAttribute = await _specificationAttributeService.GetSpecificationAttributeByOptionId(id);
- var sao = specificationAttribute.SpecificationAttributeOptions.Where(x => x.Id == id).FirstOrDefault();
+ var sao = specificationAttribute.SpecificationAttributeOptions.FirstOrDefault(x => x.Id == id);
if (sao == null)
throw new ArgumentException("No specification attribute option found with the specified id");
diff --git a/src/Web/Grand.Web.Admin/Controllers/StoreController.cs b/src/Web/Grand.Web.Admin/Controllers/StoreController.cs
index 8433da074..e83e08709 100644
--- a/src/Web/Grand.Web.Admin/Controllers/StoreController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/StoreController.cs
@@ -2,7 +2,7 @@
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Interfaces.Common.Stores;
using Grand.Business.Core.Utilities.Common.Security;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Stores;
using Grand.Web.Common.DataSource;
@@ -13,7 +13,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Stores)]
- public partial class StoreController : BaseAdminController
+ public class StoreController : BaseAdminController
{
private readonly IStoreViewModelService _storeViewModelService;
private readonly IStoreService _storeService;
@@ -44,7 +44,7 @@ namespace Grand.Web.Admin.Controllers
var gridModel = new DataSourceResult {
Data = storeModels,
- Total = storeModels.Count()
+ Total = storeModels.Count
};
return Json(gridModel);
diff --git a/src/Web/Grand.Web.Admin/Controllers/SystemController.cs b/src/Web/Grand.Web.Admin/Controllers/SystemController.cs
index f1a2b5cc8..86154b87c 100644
--- a/src/Web/Grand.Web.Admin/Controllers/SystemController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/SystemController.cs
@@ -18,7 +18,6 @@ using Grand.Web.Admin.Models.Common;
using Grand.Web.Common.DataSource;
using Grand.Web.Common.Security.Authorization;
using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Hosting;
using System.Runtime.InteropServices;
@@ -26,7 +25,7 @@ using System.Runtime.InteropServices;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.System)]
- public partial class SystemController : BaseAdminController
+ public class SystemController : BaseAdminController
{
#region Fields
@@ -120,13 +119,13 @@ namespace Grand.Web.Admin.Controllers
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies().ToList().OrderBy(x => x.FullName))
{
model.LoadedAssemblies.Add(new SystemInfoModel.LoadedAssembly {
- FullName = assembly.FullName,
+ FullName = assembly.FullName
});
}
//current host
var currenthostName = _workContext.CurrentHost.HostName;
- if (!string.IsNullOrEmpty(currenthostName) && (currenthostName.Equals(HttpContext.Request.Host.Value, StringComparison.OrdinalIgnoreCase)))
+ if (!string.IsNullOrEmpty(currenthostName) && currenthostName.Equals(HttpContext.Request.Host.Value, StringComparison.OrdinalIgnoreCase))
model.SystemWarnings.Add(new SystemInfoModel.SystemWarningModel {
Level = SystemInfoModel.SystemWarningModel.SystemWarningLevel.Pass,
Text = _translationService.GetResource("Admin.System.Warnings.URL.Match")
@@ -144,7 +143,7 @@ namespace Grand.Web.Admin.Controllers
{
model.SystemWarnings.Add(new SystemInfoModel.SystemWarningModel {
Level = SystemInfoModel.SystemWarningModel.SystemWarningLevel.Pass,
- Text = _translationService.GetResource("Admin.System.Warnings.ExchangeCurrency.Set"),
+ Text = _translationService.GetResource("Admin.System.Warnings.ExchangeCurrency.Set")
});
if (perCurrency.Rate != 1)
{
@@ -168,7 +167,7 @@ namespace Grand.Web.Admin.Controllers
{
model.SystemWarnings.Add(new SystemInfoModel.SystemWarningModel {
Level = SystemInfoModel.SystemWarningModel.SystemWarningLevel.Pass,
- Text = _translationService.GetResource("Admin.System.Warnings.PrimaryCurrency.Set"),
+ Text = _translationService.GetResource("Admin.System.Warnings.PrimaryCurrency.Set")
});
}
else
@@ -186,7 +185,7 @@ namespace Grand.Web.Admin.Controllers
{
model.SystemWarnings.Add(new SystemInfoModel.SystemWarningModel {
Level = SystemInfoModel.SystemWarningModel.SystemWarningLevel.Pass,
- Text = _translationService.GetResource("Admin.System.Warnings.DefaultWeight.Set"),
+ Text = _translationService.GetResource("Admin.System.Warnings.DefaultWeight.Set")
});
if (bWeight.Ratio != 1)
@@ -212,7 +211,7 @@ namespace Grand.Web.Admin.Controllers
{
model.SystemWarnings.Add(new SystemInfoModel.SystemWarningModel {
Level = SystemInfoModel.SystemWarningModel.SystemWarningLevel.Pass,
- Text = _translationService.GetResource("Admin.System.Warnings.DefaultDimension.Set"),
+ Text = _translationService.GetResource("Admin.System.Warnings.DefaultDimension.Set")
});
if (bDimension.Ratio != 1)
@@ -324,7 +323,7 @@ namespace Grand.Web.Admin.Controllers
return new
{
FileName = x.OriginalFile,
- IsCompiled = x.IsCompiled,
+ x.IsCompiled,
Errors = string.Join(",", x.ErrorInfo)
};
}),
diff --git a/src/Web/Grand.Web.Admin/Controllers/TaxController.cs b/src/Web/Grand.Web.Admin/Controllers/TaxController.cs
index afa4719a2..19416b3f7 100644
--- a/src/Web/Grand.Web.Admin/Controllers/TaxController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/TaxController.cs
@@ -9,7 +9,6 @@ using Grand.Domain.Tax;
using Grand.Infrastructure;
using Grand.Infrastructure.Caching;
using Grand.Infrastructure.Plugins;
-using Grand.Web.Admin.Extensions;
using Grand.Web.Admin.Models.Tax;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
@@ -18,11 +17,13 @@ using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Web.Admin.Models.Common;
using Grand.Domain.Directory;
using Grand.Business.Core.Interfaces.Common.Logging;
+using Grand.Web.Admin.Extensions.Mapping;
+using Grand.Web.Admin.Extensions.Mapping.Settings;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.TaxSettings)]
- public partial class TaxController : BaseAdminController
+ public class TaxController : BaseAdminController
{
#region Fields
@@ -75,7 +76,7 @@ namespace Grand.Web.Admin.Controllers
public async Task<IActionResult> Providers(DataSourceRequest command)
{
var storeScope = await GetActiveStore();
- var taxSettings = _settingService.LoadSetting<TaxSettings>(storeScope);
+ _settingService.LoadSetting<TaxSettings>(storeScope);
var taxProviderSettings = _settingService.LoadSetting<TaxProviderSettings>();
var taxProviders = _taxService.LoadAllTaxProviders()
@@ -96,7 +97,7 @@ namespace Grand.Web.Admin.Controllers
var gridModel = new DataSourceResult
{
Data = taxProvidersModel,
- Total = taxProvidersModel.Count()
+ Total = taxProvidersModel.Count
};
return Json(gridModel);
@@ -106,7 +107,7 @@ namespace Grand.Web.Admin.Controllers
{
var taxProviderettings = _settingService.LoadSetting<TaxProviderSettings>();
- if (String.IsNullOrEmpty(systemName))
+ if (string.IsNullOrEmpty(systemName))
{
return RedirectToAction("Providers");
}
@@ -143,12 +144,12 @@ namespace Grand.Web.Admin.Controllers
var taxCategories = await _taxCategoryService.GetAllTaxCategories();
model.TaxCategories.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Configuration.Tax.Settings.TaxCategories.None"), Value = "" });
foreach (var tc in taxCategories)
- model.TaxCategories.Add(new SelectListItem { Text = tc.Name, Value = tc.Id.ToString()});
+ model.TaxCategories.Add(new SelectListItem { Text = tc.Name, Value = tc.Id});
//EU VAT countries
model.EuVatShopCountries.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Address.SelectCountry"), Value = "" });
foreach (var c in await _countryService.GetAllCountries(showHidden: true))
- model.EuVatShopCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id.ToString(), Selected = c.Id == taxSettings.EuVatShopCountryId });
+ model.EuVatShopCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id, Selected = c.Id == taxSettings.EuVatShopCountryId });
//default tax address
var defaultAddress = taxSettings.DefaultTaxAddress;
@@ -159,13 +160,13 @@ namespace Grand.Web.Admin.Controllers
model.DefaultTaxAddress.AvailableCountries.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Address.SelectCountry"), Value = "" });
foreach (var c in await _countryService.GetAllCountries(showHidden: true))
- model.DefaultTaxAddress.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id.ToString(), Selected = (defaultAddress != null && c.Id == defaultAddress.CountryId) });
+ model.DefaultTaxAddress.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id, Selected = defaultAddress != null && c.Id == defaultAddress.CountryId });
- var states = defaultAddress != null && !String.IsNullOrEmpty(defaultAddress.CountryId) ? (await _countryService.GetCountryById(defaultAddress.CountryId))?.StateProvinces : new List<StateProvince>();
+ var states = defaultAddress != null && !string.IsNullOrEmpty(defaultAddress.CountryId) ? (await _countryService.GetCountryById(defaultAddress.CountryId))?.StateProvinces : new List<StateProvince>();
if (states.Count > 0)
{
foreach (var s in states)
- model.DefaultTaxAddress.AvailableStates.Add(new SelectListItem { Text = s.Name, Value = s.Id.ToString(), Selected = (s.Id == defaultAddress.StateProvinceId) });
+ model.DefaultTaxAddress.AvailableStates.Add(new SelectListItem { Text = s.Name, Value = s.Id, Selected = s.Id == defaultAddress.StateProvinceId });
}
model.DefaultTaxAddress.CountryEnabled = true;
diff --git a/src/Web/Grand.Web.Admin/Controllers/VendorController.cs b/src/Web/Grand.Web.Admin/Controllers/VendorController.cs
index ee0911c00..ee19f2808 100644
--- a/src/Web/Grand.Web.Admin/Controllers/VendorController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/VendorController.cs
@@ -4,7 +4,7 @@ using Grand.Business.Core.Utilities.Common.Security;
using Grand.Business.Core.Commands.Customers;
using Grand.Business.Core.Interfaces.Customers;
using Grand.Infrastructure;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Vendors;
using Grand.Web.Common.DataSource;
@@ -16,7 +16,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Vendors)]
- public partial class VendorController : BaseAdminController
+ public class VendorController : BaseAdminController
{
#region Fields
@@ -69,7 +69,7 @@ namespace Grand.Web.Admin.Controllers
var vendorModel = x.ToModel();
return vendorModel;
}),
- Total = vendors.TotalCount,
+ Total = vendors.TotalCount
};
return Json(gridModel);
}
@@ -192,8 +192,7 @@ namespace Grand.Web.Admin.Controllers
return RedirectToAction("Edit", new { id = vendor.Id });
}
- var activate = await _mediator.Send(new ActiveVendorCommand()
- {
+ var activate = await _mediator.Send(new ActiveVendorCommand {
Vendor = vendor,
Active = activatevendor == "active",
CustomerIds = associatedCustomers.Select(x => x.Id).ToList()
@@ -299,7 +298,7 @@ namespace Grand.Web.Admin.Controllers
var gridModel = new DataSourceResult
{
Data = items,
- Total = vendorReviews.TotalCount,
+ Total = vendorReviews.TotalCount
};
return Json(gridModel);
diff --git a/src/Web/Grand.Web.Admin/Controllers/VendorReviewController.cs b/src/Web/Grand.Web.Admin/Controllers/VendorReviewController.cs
index 8813146a7..c51639b65 100644
--- a/src/Web/Grand.Web.Admin/Controllers/VendorReviewController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/VendorReviewController.cs
@@ -4,7 +4,6 @@ using Grand.Business.Core.Utilities.Common.Security;
using Grand.Business.Core.Interfaces.Customers;
using Grand.Infrastructure;
using Grand.Web.Admin.Interfaces;
-using Grand.Web.Admin.Models.Customers;
using Grand.Web.Admin.Models.Vendors;
using Grand.Web.Common.DataSource;
using Grand.Web.Common.Filters;
@@ -14,7 +13,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.VendorReviews)]
- public partial class VendorReviewController : BaseAdminController
+ public class VendorReviewController : BaseAdminController
{
#region Fields
@@ -75,7 +74,7 @@ namespace Grand.Web.Admin.Controllers
var (vendorReviewModels, totalCount) = await _vendorViewModelService.PrepareVendorReviewModel(model, command.Page, command.PageSize);
var gridModel = new DataSourceResult {
Data = vendorReviewModels.ToList(),
- Total = totalCount,
+ Total = totalCount
};
return Json(gridModel);
@@ -109,7 +108,7 @@ namespace Grand.Web.Admin.Controllers
{
vendorReview = await _vendorViewModelService.UpdateVendorReviewModel(vendorReview, model);
Success(_translationService.GetResource("Admin.VendorReviews.Updated"));
- return continueEditing ? RedirectToAction("Edit", new { id = vendorReview.Id, VendorId = vendorReview.VendorId }) : RedirectToAction("List");
+ return continueEditing ? RedirectToAction("Edit", new { id = vendorReview.Id, vendorReview.VendorId }) : RedirectToAction("List");
}
//If we got this far, something failed, redisplay form
@@ -164,7 +163,7 @@ namespace Grand.Web.Admin.Controllers
public async Task<IActionResult> VendorSearchAutoComplete(string term)
{
const int searchTermMinimumLength = 3;
- if (String.IsNullOrWhiteSpace(term) || term.Length < searchTermMinimumLength)
+ if (string.IsNullOrWhiteSpace(term) || term.Length < searchTermMinimumLength)
return Content("");
var vendors = await _vendorService.SearchVendors(
diff --git a/src/Web/Grand.Web.Admin/Controllers/WidgetController.cs b/src/Web/Grand.Web.Admin/Controllers/WidgetController.cs
index 92f435915..fad3e8a97 100644
--- a/src/Web/Grand.Web.Admin/Controllers/WidgetController.cs
+++ b/src/Web/Grand.Web.Admin/Controllers/WidgetController.cs
@@ -5,6 +5,7 @@ using Grand.Domain.Cms;
using Grand.Infrastructure.Caching;
using Grand.Infrastructure.Plugins;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Models.Cms;
using Grand.Web.Common.DataSource;
using Grand.Web.Common.Security.Authorization;
@@ -13,7 +14,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Grand.Web.Admin.Controllers
{
[PermissionAuthorize(PermissionSystemName.Widgets)]
- public partial class WidgetController : BaseAdminController
+ public class WidgetController : BaseAdminController
{
#region Fields
@@ -71,7 +72,7 @@ namespace Grand.Web.Admin.Controllers
var gridModel = new DataSourceResult
{
Data = widgetsModel,
- Total = widgetsModel.Count()
+ Total = widgetsModel.Count
};
return Json(gridModel);
diff --git a/src/Web/Grand.Web.Admin/Endpoints/EndpointProvider.cs b/src/Web/Grand.Web.Admin/Endpoints/EndpointProvider.cs
index 8802a186f..7aba0d0b4 100644
--- a/src/Web/Grand.Web.Admin/Endpoints/EndpointProvider.cs
+++ b/src/Web/Grand.Web.Admin/Endpoints/EndpointProvider.cs
@@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Routing;
namespace Grand.Web.Admin.Endpoints
{
- public partial class EndpointProvider : IEndpointProvider
+ public class EndpointProvider : IEndpointProvider
{
public void RegisterEndpoint(IEndpointRouteBuilder endpointRouteBuilder)
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/AclMappingExtension.cs b/src/Web/Grand.Web.Admin/Extensions/AclMappingExtension.cs
index ef1066e5a..4f604e2f8 100644
--- a/src/Web/Grand.Web.Admin/Extensions/AclMappingExtension.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/AclMappingExtension.cs
@@ -21,7 +21,7 @@ namespace Grand.Web.Admin.Extensions
//return true if no store specified/found
return true;
- if (entity.LimitedToStores && entity.Stores.Where(x => x == storeId).Any() && entity.Stores.Count == 1)
+ if (entity.LimitedToStores && entity.Stores.Any(x => x == storeId) && entity.Stores.Count == 1)
//yes, we have such permission
return true;
diff --git a/src/Web/Grand.Web.Admin/Extensions/AttributeParserHelper.cs b/src/Web/Grand.Web.Admin/Extensions/AttributeParserHelper.cs
index 17b3f669a..c1bbb1194 100644
--- a/src/Web/Grand.Web.Admin/Extensions/AttributeParserHelper.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/AttributeParserHelper.cs
@@ -21,7 +21,7 @@ namespace Grand.Web.Admin.Extensions
var attributes = await addressAttributeService.GetAllAddressAttributes();
foreach (var attribute in attributes)
{
- string controlId = string.Format("address_attribute_{0}", attribute.Id);
+ var controlId = $"address_attribute_{attribute.Id}";
switch (attribute.AttributeControlType)
{
case AttributeControlType.DropdownList:
@@ -69,7 +69,7 @@ namespace Grand.Web.Admin.Extensions
form.TryGetValue(controlId, out var ctrlAttributes);
if (!string.IsNullOrEmpty(ctrlAttributes))
{
- string enteredText = ctrlAttributes.ToString().Trim();
+ var enteredText = ctrlAttributes.ToString().Trim();
customAttributes = addressAttributeParser.AddAddressAttribute(customAttributes,
attribute, enteredText).ToList();
}
diff --git a/src/Web/Grand.Web.Admin/Extensions/HasAccess.cs b/src/Web/Grand.Web.Admin/Extensions/HasAccess.cs
index 02cc5c8ef..b97698649 100644
--- a/src/Web/Grand.Web.Admin/Extensions/HasAccess.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/HasAccess.cs
@@ -59,7 +59,7 @@ namespace Grand.Web.Admin.Extensions
var vendorId = _workContext.CurrentVendor.Id;
foreach (var shipmentItem in shipment.ShipmentItems)
{
- var orderItem = order.OrderItems.Where(x => x.Id == shipmentItem.OrderItemId).FirstOrDefault();
+ var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == shipmentItem.OrderItemId);
if (orderItem != null)
{
if (orderItem.VendorId == vendorId)
diff --git a/src/Web/Grand.Web.Admin/Extensions/KnowledgebaseExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/KnowledgebaseExtensions.cs
index cf9dab8a7..bcbfdd7e2 100644
--- a/src/Web/Grand.Web.Admin/Extensions/KnowledgebaseExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/KnowledgebaseExtensions.cs
@@ -21,15 +21,15 @@ namespace Grand.Web.Admin.Extensions
IList<KnowledgebaseCategory> allCategories,
string separator = ">>", string languageId = "")
{
- string result = string.Empty;
+ var result = string.Empty;
var breadcrumb = GetCategoryBreadCrumb(category, allCategories);
- for (int i = 0; i <= breadcrumb.Count - 1; i++)
+ for (var i = 0; i <= breadcrumb.Count - 1; i++)
{
var categoryName = breadcrumb[i].GetTranslation(x => x.Name, languageId);
- result = String.IsNullOrEmpty(result)
+ result = string.IsNullOrEmpty(result)
? categoryName
- : string.Format("{0} {1} {2}", result, separator, categoryName);
+ : $"{result} {separator} {categoryName}";
}
return result;
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/AddressAttributeMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/AddressAttributeMappingExtensions.cs
index 61ae2e6e9..9cbfb8b9e 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/AddressAttributeMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/AddressAttributeMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Common;
+using Grand.Domain.Common;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Common;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class AddressAttributeMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/AddressMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/AddressMappingExtensions.cs
index 7c1ec266c..ffc6897f7 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/AddressMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/AddressMappingExtensions.cs
@@ -1,11 +1,11 @@
using Grand.Business.Core.Interfaces.Common.Addresses;
using Grand.Business.Core.Interfaces.Common.Directory;
-using Grand.Infrastructure.Mapper;
using Grand.Domain.Catalog;
using Grand.Domain.Common;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Common;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class AddressMappingExtensions
{
@@ -55,7 +55,7 @@ namespace Grand.Web.Admin.Extensions
Id = attribute.Id,
Name = attribute.Name,
IsRequired = attribute.IsRequired,
- AttributeControlType = attribute.AttributeControlType,
+ AttributeControlType = attribute.AttributeControlType
};
if (attribute.ShouldHaveValues())
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/BlogCategoryMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/BlogCategoryMappingExtensions.cs
index 2e7cee25e..09a4bdb04 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/BlogCategoryMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/BlogCategoryMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Blogs;
+using Grand.Domain.Blogs;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Blogs;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class BlogCategoryMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/BlogPostMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/BlogPostMappingExtensions.cs
index cd731b494..7e39f66f9 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/BlogPostMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/BlogPostMappingExtensions.cs
@@ -1,9 +1,9 @@
using Grand.Business.Core.Interfaces.Common.Directory;
-using Grand.Infrastructure.Mapper;
using Grand.Domain.Blogs;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Blogs;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class BlogPostMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/BrandMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/BrandMappingExtensions.cs
index fcf8b8dfe..c02d5a2a1 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/BrandMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/BrandMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Catalog;
+using Grand.Domain.Catalog;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Catalog;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class BrandMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/CampaignMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/CampaignMappingExtensions.cs
index 7c7a2be03..b82747a88 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/CampaignMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/CampaignMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Messages;
+using Grand.Domain.Messages;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Messages;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class CampaignMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/CategoryMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/CategoryMappingExtensions.cs
index d5a1aa1b4..8cbdd1be8 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/CategoryMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/CategoryMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Catalog;
+using Grand.Domain.Catalog;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Catalog;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class CategoryMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/CheckoutAttributeMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/CheckoutAttributeMappingExtensions.cs
index ed3164f0f..7f0364769 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/CheckoutAttributeMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/CheckoutAttributeMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Orders;
+using Grand.Domain.Orders;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Orders;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class CheckoutAttributeMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/CollectionMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/CollectionMappingExtensions.cs
index 83574d8e6..7448a351a 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/CollectionMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/CollectionMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Catalog;
+using Grand.Domain.Catalog;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Catalog;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class CollectionMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/ContactAttributeMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/ContactAttributeMappingExtensions.cs
index f9487d3c2..3d2d9c7b2 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/ContactAttributeMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/ContactAttributeMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Messages;
+using Grand.Domain.Messages;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Messages;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class ContactAttributeMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/ContactUsMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/ContactUsMappingExtensions.cs
index 3360a71af..7d9741106 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/ContactUsMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/ContactUsMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Messages;
+using Grand.Domain.Messages;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Messages;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class ContactUsMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/CountryMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/CountryMappingExtensions.cs
index f4ad9653b..cc79f3fcc 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/CountryMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/CountryMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Directory;
+using Grand.Domain.Directory;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Directory;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class CountryMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/CourseLessonMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/CourseLessonMappingExtensions.cs
index f11ff881d..b08a2e8e5 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/CourseLessonMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/CourseLessonMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Courses;
+using Grand.Domain.Courses;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Courses;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class CourseLessonMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/CourseLevelMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/CourseLevelMappingExtensions.cs
index 9e7e05998..e0823d283 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/CourseLevelMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/CourseLevelMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Courses;
+using Grand.Domain.Courses;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Courses;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class CourseLevelMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/CourseMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/CourseMappingExtensions.cs
index 97ef9e34a..6f0adb3df 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/CourseMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/CourseMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Courses;
+using Grand.Domain.Courses;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Courses;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class CourseMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/CourseSubjectMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/CourseSubjectMappingExtensions.cs
index 106e58f60..d7b52a045 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/CourseSubjectMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/CourseSubjectMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Courses;
+using Grand.Domain.Courses;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Courses;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class CourseSubjectMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/CurrencyMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/CurrencyMappingExtensions.cs
index 2e8add097..10dbd4482 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/CurrencyMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/CurrencyMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Directory;
+using Grand.Domain.Directory;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Directory;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class CurrencyMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/CustomerAttributeMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/CustomerAttributeMappingExtensions.cs
index 0010d5e3b..a0ee77937 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/CustomerAttributeMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/CustomerAttributeMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Customers;
+using Grand.Domain.Customers;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Customers;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class CustomerAttributeMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/CustomerGroupMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/CustomerGroupMappingExtensions.cs
index d11c2b76d..d4e9b0fab 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/CustomerGroupMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/CustomerGroupMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Customers;
+using Grand.Domain.Customers;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Customers;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class CustomerGroupMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/CustomerTagMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/CustomerTagMappingExtensions.cs
index c2053231c..1f9dd15eb 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/CustomerTagMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/CustomerTagMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Customers;
+using Grand.Domain.Customers;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Customers;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class CustomerTagMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/DateTimeMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/DateTimeMappingExtensions.cs
index 8ed004a40..f9e3329d5 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/DateTimeMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/DateTimeMappingExtensions.cs
@@ -1,16 +1,12 @@
using Grand.Business.Core.Interfaces.Common.Directory;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class DateTimeMappingExtensions
{
public static DateTime? ConvertToUserTime(this DateTime? datetime, IDateTimeService dateTimeService)
{
- if (datetime.HasValue)
- {
- if(datetime.Value.Kind == DateTimeKind.Utc)
- datetime = dateTimeService.ConvertToUserTime(datetime.Value, TimeZoneInfo.Utc, dateTimeService.CurrentTimeZone);
- }
+ if (datetime is { Kind: DateTimeKind.Utc }) datetime = dateTimeService.ConvertToUserTime(datetime.Value, TimeZoneInfo.Utc, dateTimeService.CurrentTimeZone);
return datetime;
}
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/DeliveryDateMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/DeliveryDateMappingExtensions.cs
index 6cdd9f661..994504854 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/DeliveryDateMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/DeliveryDateMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Shipping;
+using Grand.Domain.Shipping;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Shipping;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class DeliveryDateMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/DiscountMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/DiscountMappingExtensions.cs
index 63bd6d0f7..6cdf9f81c 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/DiscountMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/DiscountMappingExtensions.cs
@@ -1,9 +1,9 @@
using Grand.Business.Core.Interfaces.Common.Directory;
-using Grand.Infrastructure.Mapper;
using Grand.Domain.Discounts;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Discounts;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class DiscountMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/DocumentMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/DocumentMappingExtensions.cs
index fbe6f4205..316796377 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/DocumentMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/DocumentMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Documents;
+using Grand.Domain.Documents;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Documents;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class DocumentMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/EmailAccountMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/EmailAccountMappingExtensions.cs
index 015852bbb..271c10418 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/EmailAccountMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/EmailAccountMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Messages;
+using Grand.Domain.Messages;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Messages;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class EmailAccountMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/GiftVoucherMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/GiftVoucherMappingExtensions.cs
index 56eaba8db..e7cd5f4b1 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/GiftVoucherMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/GiftVoucherMappingExtensions.cs
@@ -1,9 +1,9 @@
-using Grand.Infrastructure.Mapper;
+using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Domain.Orders;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Orders;
-using Grand.Business.Core.Interfaces.Common.Directory;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class GiftVoucherMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/IExternalAuthenticationMethodMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/IExternalAuthenticationMethodMappingExtensions.cs
index fc14e3fe2..bf79c9c66 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/IExternalAuthenticationMethodMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/IExternalAuthenticationMethodMappingExtensions.cs
@@ -2,7 +2,7 @@
using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.ExternalAuthentication;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class IExternalAuthenticationMethodMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/IPaymentMethodMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/IPaymentMethodMappingExtensions.cs
index f2725f010..8c4c03235 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/IPaymentMethodMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/IPaymentMethodMappingExtensions.cs
@@ -2,7 +2,7 @@
using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Payments;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class IPaymentMethodMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/IShippingRateComputationMethodMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/IShippingRateComputationMethodMappingExtensions.cs
index 64f883b36..d3a660980 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/IShippingRateComputationMethodMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/IShippingRateComputationMethodMappingExtensions.cs
@@ -2,7 +2,7 @@
using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Shipping;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class IShippingRateComputationMethodMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/ITaxProviderMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/ITaxProviderMappingExtensions.cs
index bb0c6ad97..460ba8515 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/ITaxProviderMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/ITaxProviderMappingExtensions.cs
@@ -2,7 +2,7 @@
using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Tax;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class ITaxProviderMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/IWidgetPluginMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/IWidgetPluginMappingExtensions.cs
index 68e494afb..62360481f 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/IWidgetPluginMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/IWidgetPluginMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Business.Core.Interfaces.Cms;
+using Grand.Business.Core.Interfaces.Cms;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Cms;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class IWidgetPluginMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/KnowledgebaseCategoryMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/KnowledgebaseCategoryMappingExtensions.cs
index 7016dc939..54eb2d6e7 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/KnowledgebaseCategoryMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/KnowledgebaseCategoryMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Knowledgebase;
+using Grand.Domain.Knowledgebase;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Knowledgebase;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class KnowledgebaseCategoryMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/LanguageMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/LanguageMappingExtensions.cs
index 9c7798f41..b4f91a6fb 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/LanguageMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/LanguageMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Localization;
+using Grand.Domain.Localization;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Localization;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class LanguageMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Layouts/BrandLayoutMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Layouts/BrandLayoutMappingExtensions.cs
index 49cd6549f..2be754125 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Layouts/BrandLayoutMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Layouts/BrandLayoutMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Catalog;
+using Grand.Domain.Catalog;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Layouts;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Layouts
{
public static class BrandLayoutMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Layouts/CategoryLayoutMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Layouts/CategoryLayoutMappingExtensions.cs
index 28f84791e..b9725c711 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Layouts/CategoryLayoutMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Layouts/CategoryLayoutMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Catalog;
+using Grand.Domain.Catalog;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Layouts;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Layouts
{
public static class CategoryLayoutMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Layouts/CollectionLayoutMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Layouts/CollectionLayoutMappingExtensions.cs
index 7f3553d46..c456abfbf 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Layouts/CollectionLayoutMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Layouts/CollectionLayoutMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Catalog;
+using Grand.Domain.Catalog;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Layouts;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Layouts
{
public static class CollectionLayoutMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Layouts/PageLayoutMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Layouts/PageLayoutMappingExtensions.cs
index a00e58297..3ef440789 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Layouts/PageLayoutMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Layouts/PageLayoutMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Pages;
+using Grand.Domain.Pages;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Layouts;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Layouts
{
public static class PageLayoutMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Layouts/ProductLayoutMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Layouts/ProductLayoutMappingExtensions.cs
index 91fb6cbf8..4364aab4b 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Layouts/ProductLayoutMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Layouts/ProductLayoutMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Catalog;
+using Grand.Domain.Catalog;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Layouts;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Layouts
{
public static class ProductLayoutMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/LogMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/LogMappingExtensions.cs
index 9604dde27..ffa830a5e 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/LogMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/LogMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Logging;
+using Grand.Domain.Logging;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Logging;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class LogMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/MeasureDimensionMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/MeasureDimensionMappingExtensions.cs
index 64a6da30d..d945ff496 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/MeasureDimensionMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/MeasureDimensionMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Directory;
+using Grand.Domain.Directory;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Directory;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class MeasureDimensionMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/MeasureUnitMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/MeasureUnitMappingExtensions.cs
index afd15404e..c867ca8a2 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/MeasureUnitMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/MeasureUnitMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Directory;
+using Grand.Domain.Directory;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Directory;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class MeasureUnitMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/MeasureWeightMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/MeasureWeightMappingExtensions.cs
index 8e7f49415..ff4a45a6c 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/MeasureWeightMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/MeasureWeightMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Directory;
+using Grand.Domain.Directory;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Directory;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class MeasureWeightMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/MerchandiseReturnActionMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/MerchandiseReturnActionMappingExtensions.cs
index 0a4157a81..4c6491183 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/MerchandiseReturnActionMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/MerchandiseReturnActionMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Orders;
+using Grand.Domain.Orders;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Settings;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class MerchandiseReturnActionMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/MerchandiseReturnReasonMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/MerchandiseReturnReasonMappingExtensions.cs
index 0b77824d9..25361bb98 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/MerchandiseReturnReasonMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/MerchandiseReturnReasonMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Orders;
+using Grand.Domain.Orders;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Settings;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class MerchandiseReturnReasonMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/MessageTemplateMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/MessageTemplateMappingExtensions.cs
index 502b10bb2..baed54b94 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/MessageTemplateMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/MessageTemplateMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Messages;
+using Grand.Domain.Messages;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Messages;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class MessageTemplateMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/NewsItemMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/NewsItemMappingExtensions.cs
index 171a3b137..e0cf1df4f 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/NewsItemMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/NewsItemMappingExtensions.cs
@@ -1,9 +1,9 @@
using Grand.Business.Core.Interfaces.Common.Directory;
-using Grand.Infrastructure.Mapper;
using Grand.Domain.News;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.News;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class NewsItemMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/NewsLetterSubscriptionMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/NewsLetterSubscriptionMappingExtensions.cs
index ca218eaeb..48b2411e3 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/NewsLetterSubscriptionMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/NewsLetterSubscriptionMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Messages;
+using Grand.Domain.Messages;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Messages;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class NewsLetterSubscriptionMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/NewsletterCategoryMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/NewsletterCategoryMappingExtensions.cs
index 1bcf901ab..49369d145 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/NewsletterCategoryMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/NewsletterCategoryMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Messages;
+using Grand.Domain.Messages;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Messages;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class NewsletterCategoryMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/OrderStatusMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/OrderStatusMappingExtensions.cs
index 0a71fb8ff..5df4b6a9e 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/OrderStatusMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/OrderStatusMappingExtensions.cs
@@ -2,7 +2,7 @@
using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Orders;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class OrderStatusMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/PageMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/PageMappingExtensions.cs
index d012fba41..fe10974d2 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/PageMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/PageMappingExtensions.cs
@@ -1,9 +1,9 @@
-using Grand.Infrastructure.Mapper;
+using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Domain.Pages;
-using Grand.Business.Core.Interfaces.Common.Directory;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Pages;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class PageMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/PickupPointMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/PickupPointMappingExtensions.cs
index eeffd35d7..095a05250 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/PickupPointMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/PickupPointMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Shipping;
+using Grand.Domain.Shipping;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Shipping;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class PickupPointMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/PluginDescriptorMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/PluginDescriptorMappingExtensions.cs
index 6f728b726..f0df6dc02 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/PluginDescriptorMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/PluginDescriptorMappingExtensions.cs
@@ -2,7 +2,7 @@
using Grand.Infrastructure.Plugins;
using Grand.Web.Admin.Models.Plugins;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class PluginDescriptorMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/ProductAttributeCombinationMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/ProductAttributeCombinationMappingExtensions.cs
index a1eab3b81..92379f67e 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/ProductAttributeCombinationMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/ProductAttributeCombinationMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Catalog;
+using Grand.Domain.Catalog;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Catalog;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class ProductAttributeCombinationMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/ProductAttributeMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/ProductAttributeMappingExtensions.cs
index b71a0db15..3e037795d 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/ProductAttributeMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/ProductAttributeMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Catalog;
+using Grand.Domain.Catalog;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Catalog;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class ProductAttributeMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/ProductAttributeMappingMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/ProductAttributeMappingMappingExtensions.cs
index 7d9e5a369..7e564dbbf 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/ProductAttributeMappingMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/ProductAttributeMappingMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Catalog;
+using Grand.Domain.Catalog;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Catalog;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class ProductAttributeMappingMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/ProductReviewMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/ProductReviewMappingExtensions.cs
index b6a40b69d..f4ea0acc9 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/ProductReviewMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/ProductReviewMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Catalog;
+using Grand.Domain.Catalog;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Catalog;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class ProductReviewMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/ProductSpecificationMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/ProductSpecificationMappingExtensions.cs
index d098d34d8..19ad07485 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/ProductSpecificationMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/ProductSpecificationMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Catalog;
+using Grand.Domain.Catalog;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Catalog;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class ProductSpecificationMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/ProductsMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/ProductsMappingExtensions.cs
index b6a98fcc9..637576820 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/ProductsMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/ProductsMappingExtensions.cs
@@ -1,9 +1,9 @@
-using Grand.Infrastructure.Mapper;
+using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Domain.Catalog;
-using Grand.Business.Core.Interfaces.Common.Directory;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Catalog;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class ProductsMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/QueuedEmailMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/QueuedEmailMappingExtensions.cs
index 322fd7fd0..4979c9442 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/QueuedEmailMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/QueuedEmailMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Messages;
+using Grand.Domain.Messages;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Messages;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class QueuedEmailMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/SalesEmployeeMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/SalesEmployeeMappingExtensions.cs
index b5fa230b3..e161496f2 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/SalesEmployeeMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/SalesEmployeeMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Customers;
+using Grand.Domain.Customers;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Customers;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class SalesEmployeeMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/AddressSettingsMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/AddressSettingsMappingExtensions.cs
index 8870a5e7f..d41fa5b2e 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/AddressSettingsMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/AddressSettingsMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Common;
+using Grand.Domain.Common;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Settings;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Settings
{
public static class AddressSettingsMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/AdminSearchSettingsMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/AdminSearchSettingsMappingExtensions.cs
index a02b88f81..8b251ac3d 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/AdminSearchSettingsMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/AdminSearchSettingsMappingExtensions.cs
@@ -2,7 +2,7 @@
using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Settings;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Settings
{
public static class AdminSearchSettingsMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/BlogSettingsMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/BlogSettingsMappingExtensions.cs
index af221fffa..93991b47a 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/BlogSettingsMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/BlogSettingsMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Blogs;
+using Grand.Domain.Blogs;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Settings;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Settings
{
public static class BlogSettingsMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/CatalogSettingsMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/CatalogSettingsMappingExtensions.cs
index 30a24752e..a175c88db 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/CatalogSettingsMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/CatalogSettingsMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Catalog;
+using Grand.Domain.Catalog;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Settings;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Settings
{
public static class CatalogSettingsMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/CommonSettingsMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/CommonSettingsMappingExtensions.cs
index d89d9e986..09562aec9 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/CommonSettingsMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/CommonSettingsMappingExtensions.cs
@@ -2,7 +2,7 @@
using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Settings;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Settings
{
public static class CommonSettingsMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/CustomerSettingsMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/CustomerSettingsMappingExtensions.cs
index 5b1d6214f..7178c9a2d 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/CustomerSettingsMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/CustomerSettingsMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Customers;
+using Grand.Domain.Customers;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Settings;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Settings
{
public static class CustomerSettingsMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/GoogleAnalyticsSettingsMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/GoogleAnalyticsSettingsMappingExtensions.cs
deleted file mode 100644
index 38bdc154c..000000000
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/GoogleAnalyticsSettingsMappingExtensions.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using Grand.Domain.Seo;
-using Grand.Infrastructure.Mapper;
-using Grand.Web.Admin.Models.Settings;
-
-namespace Grand.Web.Admin.Extensions
-{
- public static class GoogleAnalyticsSettingsMappingExtensions
- {
- public static GeneralCommonSettingsModel.GoogleAnalyticsSettingsModel ToModel(this GoogleAnalyticsSettings entity)
- {
- return entity.MapTo<GoogleAnalyticsSettings, GeneralCommonSettingsModel.GoogleAnalyticsSettingsModel>();
- }
- public static GoogleAnalyticsSettings ToEntity(this GeneralCommonSettingsModel.GoogleAnalyticsSettingsModel model, GoogleAnalyticsSettings destination)
- {
- return model.MapTo(destination);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/KnowledgebaseMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/KnowledgebaseMappingExtensions.cs
index 54f81e839..5fca56c5a 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/KnowledgebaseMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/KnowledgebaseMappingExtensions.cs
@@ -2,7 +2,7 @@
using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Settings;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Settings
{
public static class KnowledgebaseSettingsMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/LoyaltyPointsSettingsMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/LoyaltyPointsSettingsMappingExtensions.cs
index 49653e710..2424d3525 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/LoyaltyPointsSettingsMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/LoyaltyPointsSettingsMappingExtensions.cs
@@ -2,7 +2,7 @@
using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Settings;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Settings
{
public static class LoyaltyPointsSettingsMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/MediaSettingsMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/MediaSettingsMappingExtensions.cs
index 5db885826..14d06370b 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/MediaSettingsMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/MediaSettingsMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Media;
+using Grand.Domain.Media;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Settings;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Settings
{
public static class MediaSettingsMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/MenuItemSettingsMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/MenuItemSettingsMappingExtensions.cs
index ec634bda8..277f7a69d 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/MenuItemSettingsMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/MenuItemSettingsMappingExtensions.cs
@@ -2,7 +2,7 @@
using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Settings;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Settings
{
public static class MenuItemSettingsMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/NewsSettingsMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/NewsSettingsMappingExtensions.cs
index bace1b652..ee6efe2bd 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/NewsSettingsMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/NewsSettingsMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.News;
+using Grand.Domain.News;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Settings;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Settings
{
public static class NewsSettingsMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/OrderSettingsMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/OrderSettingsMappingExtensions.cs
index f79cf6d57..5fc824e11 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/OrderSettingsMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/OrderSettingsMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Orders;
+using Grand.Domain.Orders;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Settings;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Settings
{
public static class OrderSettingsMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/PaymentSettingsMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/PaymentSettingsMappingExtensions.cs
index 21e1c97c4..076764cf2 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/PaymentSettingsMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/PaymentSettingsMappingExtensions.cs
@@ -2,7 +2,7 @@
using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Payments;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Settings
{
public static class PaymentSettingsMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/PdfSettingsMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/PdfSettingsMappingExtensions.cs
index 21363f950..e30f35dcc 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/PdfSettingsMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/PdfSettingsMappingExtensions.cs
@@ -2,7 +2,7 @@
using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Settings;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Settings
{
public static class PdfSettingsMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/PushSettingsMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/PushSettingsMappingExtensions.cs
index 2349fcb5a..15954f871 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/PushSettingsMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/PushSettingsMappingExtensions.cs
@@ -2,7 +2,7 @@
using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Settings;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Settings
{
public static class PushSettingsMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/SecuritySettingsMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/SecuritySettingsMappingExtensions.cs
index e7ab8b861..5864abf90 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/SecuritySettingsMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/SecuritySettingsMappingExtensions.cs
@@ -2,7 +2,7 @@
using Grand.Web.Admin.Models.Settings;
using Grand.Web.Common.Security.Captcha;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Settings
{
public static class SecuritySettingsMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/SeoSettingsMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/SeoSettingsMappingExtensions.cs
index 5bdbea941..f286e829c 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/SeoSettingsMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/SeoSettingsMappingExtensions.cs
@@ -2,7 +2,7 @@
using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Settings;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Settings
{
public static class SeoSettingsMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/ShippingSettingsMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/ShippingSettingsMappingExtensions.cs
index e1a0341e7..64295fb4c 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/ShippingSettingsMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/ShippingSettingsMappingExtensions.cs
@@ -2,7 +2,7 @@
using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Shipping;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Settings
{
public static class ShippingSettingsMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/ShoppingCartSettingsMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/ShoppingCartSettingsMappingExtensions.cs
index 5654687d7..a97135620 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/ShoppingCartSettingsMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/ShoppingCartSettingsMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Orders;
+using Grand.Domain.Orders;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Settings;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Settings
{
public static class ShoppingCartSettingsMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/StoreInformationSettingsMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/StoreInformationSettingsMappingExtensions.cs
index 15bdfb03c..4ac2d1594 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/StoreInformationSettingsMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/StoreInformationSettingsMappingExtensions.cs
@@ -2,7 +2,7 @@
using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Settings;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Settings
{
public static class StoreInformationSettingsMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/TaxSettingsMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/TaxSettingsMappingExtensions.cs
index 0c417be8a..0bc210393 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/TaxSettingsMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/TaxSettingsMappingExtensions.cs
@@ -2,7 +2,7 @@
using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Tax;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Settings
{
public static class TaxSettingsMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/ThemeConfigurationMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/ThemeConfigurationMappingExtensions.cs
index 256e2440e..e6830a00d 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/ThemeConfigurationMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/ThemeConfigurationMappingExtensions.cs
@@ -2,7 +2,7 @@
using Grand.Web.Admin.Models.Settings;
using Grand.Web.Common.Themes;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Settings
{
public static class ThemeConfigurationMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/VendorSettingsMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/VendorSettingsMappingExtensions.cs
index 4f2f44da6..bf94c00ce 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/VendorSettingsMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/Settings/VendorSettingsMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Vendors;
+using Grand.Domain.Vendors;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Settings;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping.Settings
{
public static class VendorSettingsMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/ShippingMethodMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/ShippingMethodMappingExtensions.cs
index f7a6e3f74..5c36e2fca 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/ShippingMethodMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/ShippingMethodMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Shipping;
+using Grand.Domain.Shipping;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Shipping;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class ShippingMethodMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/SpecificationAttributeMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/SpecificationAttributeMappingExtensions.cs
index ad69020f5..c372b4664 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/SpecificationAttributeMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/SpecificationAttributeMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Catalog;
+using Grand.Domain.Catalog;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Catalog;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class SpecificationAttributeMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/StoreMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/StoreMappingExtensions.cs
index 3254c1a52..908ea2549 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/StoreMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/StoreMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Stores;
+using Grand.Domain.Stores;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Stores;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class StoreMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/TaxCategoryMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/TaxCategoryMappingExtensions.cs
index 49cd2b7a7..58c8fbca8 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/TaxCategoryMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/TaxCategoryMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Tax;
+using Grand.Domain.Tax;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Tax;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class TaxCategoryMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/TierPriceMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/TierPriceMappingExtensions.cs
index 65b622759..90b0564d5 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/TierPriceMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/TierPriceMappingExtensions.cs
@@ -1,9 +1,9 @@
-using Grand.Infrastructure.Mapper;
+using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Domain.Catalog;
-using Grand.Business.Core.Interfaces.Common.Directory;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Catalog;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class TierPriceMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/UserApiMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/UserApiMappingExtensions.cs
index 176631b53..87fd7b940 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/UserApiMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/UserApiMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Customers;
+using Grand.Domain.Customers;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Customers;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class UserApiMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/VendorMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/VendorMappingExtensions.cs
index e144102b4..34b85c0cc 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/VendorMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/VendorMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Vendors;
+using Grand.Domain.Vendors;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Vendors;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class VendorMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/Mapping/WarehouseMappingExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/Mapping/WarehouseMappingExtensions.cs
index b2053c5db..4e2a98e9b 100644
--- a/src/Web/Grand.Web.Admin/Extensions/Mapping/WarehouseMappingExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/Mapping/WarehouseMappingExtensions.cs
@@ -1,8 +1,8 @@
-using Grand.Infrastructure.Mapper;
-using Grand.Domain.Shipping;
+using Grand.Domain.Shipping;
+using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Shipping;
-namespace Grand.Web.Admin.Extensions
+namespace Grand.Web.Admin.Extensions.Mapping
{
public static class WarehouseMappingExtensions
{
diff --git a/src/Web/Grand.Web.Admin/Extensions/PluginExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/PluginExtensions.cs
index 8628a42d5..573f6c57d 100644
--- a/src/Web/Grand.Web.Admin/Extensions/PluginExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/PluginExtensions.cs
@@ -13,7 +13,7 @@ namespace Grand.Web.Admin.Extensions
if (workContext == null)
throw new ArgumentNullException(nameof(workContext));
- if (pluginDescriptor.OriginalAssemblyFile == null || pluginDescriptor.OriginalAssemblyFile.Directory == null)
+ if (pluginDescriptor.OriginalAssemblyFile?.Directory == null)
{
return null;
}
@@ -22,12 +22,12 @@ namespace Grand.Web.Admin.Extensions
var logoPluginJpg = Path.Combine(pluginDirectory.FullName, "logo.jpg");
if (File.Exists(logoPluginJpg))
{
- return string.Format("{0}/{1}/{2}/logo.jpg", storeLocation, pluginDirectory.Parent.Name, pluginDirectory.Name);
+ return $"{storeLocation}/{pluginDirectory.Parent.Name}/{pluginDirectory.Name}/logo.jpg";
}
var logoPluginPng = Path.Combine(pluginDirectory.FullName, "logo.png");
if (File.Exists(logoPluginPng))
{
- return string.Format("{0}/{1}/{2}/logo.png", storeLocation, pluginDirectory.Parent.Name, pluginDirectory.Name);
+ return $"{storeLocation}/{pluginDirectory.Parent.Name}/{pluginDirectory.Name}/logo.png";
}
return null;
diff --git a/src/Web/Grand.Web.Admin/Extensions/ProductExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/ProductExtensions.cs
index dfc4452bb..5ec68e4d7 100644
--- a/src/Web/Grand.Web.Admin/Extensions/ProductExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/ProductExtensions.cs
@@ -12,7 +12,8 @@ namespace Grand.Web.Admin.Extensions
/// Get product picture (for shopping cart and order details pages)
/// </summary>
/// <param name="product">Product</param>
- /// <param name="attributes">Atributes </param>
+ /// <param name="attributes">Attributes</param>
+ /// <param name="productService">Product service</param>
/// <param name="pictureService">Picture service</param>
/// <returns>Picture</returns>
public static async Task<Picture> GetProductPicture(this Product product, IList<CustomAttribute> attributes,
@@ -56,7 +57,7 @@ namespace Grand.Web.Admin.Extensions
}
if (picture == null)
{
- var pp = product.ProductPictures.OrderBy(x => x.DisplayOrder).FirstOrDefault();
+ var pp = product.ProductPictures.MinBy(x => x.DisplayOrder);
if (pp != null)
picture = await pictureService.GetPictureById(pp.PictureId);
}
diff --git a/src/Web/Grand.Web.Admin/Extensions/ProductList.cs b/src/Web/Grand.Web.Admin/Extensions/ProductList.cs
index dd98f9145..10cb6a72c 100644
--- a/src/Web/Grand.Web.Admin/Extensions/ProductList.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/ProductList.cs
@@ -11,7 +11,7 @@ namespace Grand.Web.Admin.Extensions
string searchProductName, int pageIndex, int pageSize)
{
var searchCategoryIds = new List<string>();
- if (!String.IsNullOrEmpty(searchCategoryId))
+ if (!string.IsNullOrEmpty(searchCategoryId))
searchCategoryIds.Add(searchCategoryId);
var products = (await productService.SearchProducts(
diff --git a/src/Web/Grand.Web.Admin/Extensions/TranslationExtension.cs b/src/Web/Grand.Web.Admin/Extensions/TranslationExtension.cs
index 7ca88318e..bb5025c95 100644
--- a/src/Web/Grand.Web.Admin/Extensions/TranslationExtension.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/TranslationExtension.cs
@@ -21,7 +21,7 @@ namespace Grand.Web.Admin.Extensions
PropertyInfo[] props = item.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
foreach (var prop in props)
{
- bool insert = true;
+ var insert = true;
foreach (var i in interfaces)
{
@@ -32,11 +32,10 @@ namespace Grand.Web.Admin.Extensions
}
if (insert && prop.GetValue(item) != null)
- local.Add(new TranslationEntity()
- {
+ local.Add(new TranslationEntity {
LanguageId = item.LanguageId,
LocaleKey = prop.Name,
- LocaleValue = prop.GetValue(item).ToString(),
+ LocaleValue = prop.GetValue(item)?.ToString()
});
}
}
@@ -44,7 +43,7 @@ namespace Grand.Web.Admin.Extensions
}
public static async Task<List<TranslationEntity>> ToTranslationProperty<T, E>(this IList<T> list, E entity, Expression<Func<T, string>> keySelector,
- SeoSettings _seoSettings, ISlugService _slugService, ILanguageService _languageService) where T : ILocalizedModelLocal where E : BaseEntity, ISlugEntity
+ SeoSettings seoSettings, ISlugService slugService, ILanguageService languageService) where T : ILocalizedModelLocal where E : BaseEntity, ISlugEntity
{
var local = new List<TranslationEntity>();
foreach (var item in list)
@@ -53,7 +52,7 @@ namespace Grand.Web.Admin.Extensions
PropertyInfo[] props = item.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
foreach (var prop in props)
{
- bool insert = true;
+ var insert = true;
foreach (var i in interfaces)
{
@@ -71,23 +70,23 @@ namespace Grand.Web.Admin.Extensions
if (propInfo == null)
throw new ArgumentException($"Expression '{keySelector}' refers to a field, not a property.");
- var value = item.GetType().GetProperty(propInfo.Name).GetValue(item, null);
+ var value = item.GetType().GetProperty(propInfo.Name)?.GetValue(item, null);
if (value != null)
{
var name = value.ToString();
var itemvalue = prop.GetValue(item) ?? "";
- var seName = await entity.ValidateSeName(itemvalue.ToString(), name, false, _seoSettings, _slugService, _languageService);
+ var seName = await entity.ValidateSeName(itemvalue.ToString(), name, false, seoSettings, slugService, languageService);
prop.SetValue(item, seName);
- await _slugService.SaveSlug(entity, seName, item.LanguageId);
+ await slugService.SaveSlug(entity, seName, item.LanguageId);
}
else
{
var itemvalue = prop.GetValue(item) ?? "";
- if (itemvalue != null && !string.IsNullOrEmpty(itemvalue.ToString()))
+ if (!string.IsNullOrEmpty(itemvalue.ToString()))
{
- var seName = await entity.ValidateSeName(itemvalue.ToString(), "", false, _seoSettings, _slugService, _languageService);
+ var seName = await entity.ValidateSeName(itemvalue.ToString(), "", false, seoSettings, slugService, languageService);
prop.SetValue(item, seName);
- await _slugService.SaveSlug(entity, seName, item.LanguageId);
+ await slugService.SaveSlug(entity, seName, item.LanguageId);
}
else
insert = false;
@@ -96,11 +95,10 @@ namespace Grand.Web.Admin.Extensions
}
if (insert && prop.GetValue(item) != null)
- local.Add(new TranslationEntity()
- {
+ local.Add(new TranslationEntity {
LanguageId = item.LanguageId,
LocaleKey = prop.Name,
- LocaleValue = prop.GetValue(item).ToString(),
+ LocaleValue = prop.GetValue(item)?.ToString()
});
}
}
@@ -108,7 +106,7 @@ namespace Grand.Web.Admin.Extensions
}
- public static bool HasProperty(this Type obj, string propertyName)
+ private static bool HasProperty(this Type obj, string propertyName)
{
return obj.GetProperty(propertyName) != null;
}
diff --git a/src/Web/Grand.Web.Admin/Extensions/WidgetExtensions.cs b/src/Web/Grand.Web.Admin/Extensions/WidgetExtensions.cs
index d047e7e34..c22959203 100644
--- a/src/Web/Grand.Web.Admin/Extensions/WidgetExtensions.cs
+++ b/src/Web/Grand.Web.Admin/Extensions/WidgetExtensions.cs
@@ -16,7 +16,7 @@ namespace Grand.Web.Admin.Extensions
if (widgetSettings.ActiveWidgetSystemNames == null)
return false;
- foreach (string activeMethodSystemName in widgetSettings.ActiveWidgetSystemNames)
+ foreach (var activeMethodSystemName in widgetSettings.ActiveWidgetSystemNames)
if (widget.SystemName.Equals(activeMethodSystemName, StringComparison.OrdinalIgnoreCase))
return true;
return false;
diff --git a/src/Web/Grand.Web.Admin/Grand.Web.Admin.csproj b/src/Web/Grand.Web.Admin/Grand.Web.Admin.csproj
index 2358dcac8..7ffb6c0b0 100644
--- a/src/Web/Grand.Web.Admin/Grand.Web.Admin.csproj
+++ b/src/Web/Grand.Web.Admin/Grand.Web.Admin.csproj
@@ -16,9 +16,6 @@
<PackageReference Include="elFinder.Net.AspNetCore" Version="1.5.0" />
<PackageReference Include="elFinder.Net.Core" Version="1.5.0" />
<PackageReference Include="elFinder.Net.Drivers.FileSystem" Version="1.5.0" />
- <PackageReference Include="Google.Apis" Version="1.60.0" />
- <PackageReference Include="Google.Apis.AnalyticsReporting.v4" Version="1.60.0.2484" />
- <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.16" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Business\Grand.Business.Core\Grand.Business.Core.csproj" />
diff --git a/src/Web/Grand.Web.Admin/Interfaces/ICustomerViewModelService.cs b/src/Web/Grand.Web.Admin/Interfaces/ICustomerViewModelService.cs
index f84b49425..d62b2b682 100644
--- a/src/Web/Grand.Web.Admin/Interfaces/ICustomerViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Interfaces/ICustomerViewModelService.cs
@@ -19,7 +19,7 @@ namespace Grand.Web.Admin.Interfaces
Task<Customer> InsertCustomerModel(CustomerModel model);
Task<Customer> UpdateCustomerModel(Customer customer, CustomerModel model);
Task DeleteCustomer(Customer customer);
- Task DeleteSelected(IList<string> selectedIds);
+ Task DeleteSelected(IEnumerable<string> selectedIds);
Task SendEmail(Customer customer, CustomerModel.SendEmailModel model);
Task<IEnumerable<CustomerModel.LoyaltyPointsHistoryModel>> PrepareLoyaltyPointsHistoryModel(string customerId);
Task<LoyaltyPointsHistory> InsertLoyaltyPointsHistory(Customer customer, string storeId, int addLoyaltyPointsValue, string addLoyaltyPointsMessage);
diff --git a/src/Web/Grand.Web.Admin/Interfaces/IGoogleAnalyticsViewModelService.cs b/src/Web/Grand.Web.Admin/Interfaces/IGoogleAnalyticsViewModelService.cs
deleted file mode 100644
index a158f6373..000000000
--- a/src/Web/Grand.Web.Admin/Interfaces/IGoogleAnalyticsViewModelService.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using Grand.Web.Admin.Models.Common;
-
-namespace Grand.Web.Admin.Interfaces
-{
- public partial interface IGoogleAnalyticsViewModelService
- {
- Task<GoogleAnalyticsResultModel> GetDataByGeneral(DateTime startDate, DateTime endDate);
- Task<GoogleAnalyticsResultModel> GetDataByLocalization(DateTime startDate, DateTime endDate);
- Task<GoogleAnalyticsResultModel> GetDataBySource(DateTime startDate, DateTime endDate);
- Task<GoogleAnalyticsResultModel> GetDataByExit(DateTime startDate, DateTime endDate);
- Task<GoogleAnalyticsResultModel> GetDataByDevice(DateTime startDate, DateTime endDate);
- }
-}
diff --git a/src/Web/Grand.Web.Admin/Interfaces/IProductReviewViewModelService.cs b/src/Web/Grand.Web.Admin/Interfaces/IProductReviewViewModelService.cs
index d90225bdc..6ed26ac9f 100644
--- a/src/Web/Grand.Web.Admin/Interfaces/IProductReviewViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Interfaces/IProductReviewViewModelService.cs
@@ -11,8 +11,8 @@ namespace Grand.Web.Admin.Interfaces
Task<ProductReview> UpdateProductReview(ProductReview productReview, ProductReviewModel model);
Task<ProductReviewListModel> PrepareProductReviewListModel(string storeId);
Task DeleteProductReview(ProductReview productReview);
- Task ApproveSelected(IList<string> selectedIds, string storeId);
- Task DisapproveSelected(IList<string> selectedIds, string storeId);
+ Task ApproveSelected(IEnumerable<string> selectedIds, string storeId);
+ Task DisapproveSelected(IEnumerable<string> selectedIds, string storeId);
}
}
diff --git a/src/Web/Grand.Web.Admin/Interfaces/IProductViewModelService.cs b/src/Web/Grand.Web.Admin/Interfaces/IProductViewModelService.cs
index a0085758f..ddcbeae08 100644
--- a/src/Web/Grand.Web.Admin/Interfaces/IProductViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Interfaces/IProductViewModelService.cs
@@ -20,7 +20,7 @@ namespace Grand.Web.Admin.Interfaces
Task<Product> InsertProductModel(ProductModel model);
Task<Product> UpdateProductModel(Product product, ProductModel model);
Task DeleteProduct(Product product);
- Task DeleteSelected(IList<string> selectedIds);
+ Task DeleteSelected(IEnumerable<string> selectedIds);
Task<ProductModel.AddRequiredProductModel> PrepareAddRequiredProductModel();
Task<(IList<ProductModel> products, int totalCount)> PrepareProductModel(ProductModel.AddProductModel model, int pageIndex, int pageSize);
Task<IList<ProductModel.ProductCategoryModel>> PrepareProductCategoryModel(Product product);
@@ -54,8 +54,8 @@ namespace Grand.Web.Admin.Interfaces
Task<ProductModel.AddAssociatedProductModel> PrepareAssociatedProductModel();
Task<BulkEditListModel> PrepareBulkEditListModel();
Task<(IEnumerable<BulkEditProductModel> bulkEditProductModels, int totalCount)> PrepareBulkEditProductModel(BulkEditListModel model, int pageIndex, int pageSize);
- Task UpdateBulkEdit(IList<BulkEditProductModel> products);
- Task DeleteBulkEdit(IList<BulkEditProductModel> products);
+ Task UpdateBulkEdit(IEnumerable<BulkEditProductModel> products);
+ Task DeleteBulkEdit(IEnumerable<BulkEditProductModel> products);
//tierprices
Task<IList<ProductModel.TierPriceModel>> PrepareTierPriceModel(Product product);
Task<(IEnumerable<ProductModel.BidModel> bidModels, int totalCount)> PrepareBidMode(string productId, int pageIndex, int pageSize);
diff --git a/src/Web/Grand.Web.Admin/Interfaces/IShipmentViewModelService.cs b/src/Web/Grand.Web.Admin/Interfaces/IShipmentViewModelService.cs
index 3689048ad..4ffb24234 100644
--- a/src/Web/Grand.Web.Admin/Interfaces/IShipmentViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Interfaces/IShipmentViewModelService.cs
@@ -17,7 +17,7 @@ namespace Grand.Web.Admin.Interfaces
Task DeleteShipmentNote(Shipment shipment, string id);
Task<ShipmentListModel> PrepareShipmentListModel();
Task<ShipmentModel> PrepareShipmentModel(Order order);
- Task<(Shipment shipment, double? totalWeight)> PrepareShipment(Order order, IList<OrderItem> orderItems, IFormCollection form);
+ Task<(Shipment shipment, double? totalWeight)> PrepareShipment(Order order, IEnumerable<OrderItem> orderItems, IFormCollection form);
Task<(bool valid, string message)> ValidStockShipment(Shipment shipment);
Task<(IEnumerable<Shipment> shipments, int totalCount)> PrepareShipments(ShipmentListModel model, int pageIndex, int pageSize);
}
diff --git a/src/Web/Grand.Web.Admin/Interfaces/IVendorViewModelService.cs b/src/Web/Grand.Web.Admin/Interfaces/IVendorViewModelService.cs
index 7a58ed8b7..11083fa86 100644
--- a/src/Web/Grand.Web.Admin/Interfaces/IVendorViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Interfaces/IVendorViewModelService.cs
@@ -1,5 +1,4 @@
using Grand.Domain.Vendors;
-using Grand.Web.Admin.Models.Customers;
using Grand.Web.Admin.Models.Vendors;
namespace Grand.Web.Admin.Interfaces
@@ -22,8 +21,8 @@ namespace Grand.Web.Admin.Interfaces
Task<(IEnumerable<VendorReviewModel> vendorReviewModels, int totalCount)> PrepareVendorReviewModel(VendorReviewListModel model, int pageIndex, int pageSize);
Task<VendorReview> UpdateVendorReviewModel(VendorReview vendorReview, VendorReviewModel model);
Task DeleteVendorReview(VendorReview vendorReview);
- Task ApproveVendorReviews(IList<string> selectedIds);
- Task DisapproveVendorReviews(IList<string> selectedIds);
+ Task ApproveVendorReviews(IEnumerable<string> selectedIds);
+ Task DisapproveVendorReviews(IEnumerable<string> selectedIds);
}
}
diff --git a/src/Web/Grand.Web.Admin/Mapper/GoogleAnalyticsSettingsProfile.cs b/src/Web/Grand.Web.Admin/Mapper/GoogleAnalyticsSettingsProfile.cs
deleted file mode 100644
index fc13addc0..000000000
--- a/src/Web/Grand.Web.Admin/Mapper/GoogleAnalyticsSettingsProfile.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using AutoMapper;
-using Grand.Domain.Seo;
-using Grand.Infrastructure.Mapper;
-using Grand.Web.Admin.Models.Settings;
-
-namespace Grand.Web.Admin.Mapper
-{
- public class GoogleAnalyticsSettingsProfile : Profile, IAutoMapperProfile
- {
- public GoogleAnalyticsSettingsProfile()
- {
- CreateMap<GoogleAnalyticsSettings, GeneralCommonSettingsModel.GoogleAnalyticsSettingsModel>()
- .ForMember(dest => dest.UserFields, mo => mo.Ignore());
- CreateMap<GeneralCommonSettingsModel.GoogleAnalyticsSettingsModel, GoogleAnalyticsSettings>();
- }
-
- public int Order => 0;
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Models/Affiliates/AffiliateListModel.cs b/src/Web/Grand.Web.Admin/Models/Affiliates/AffiliateListModel.cs
index f0a330257..5337d7f96 100644
--- a/src/Web/Grand.Web.Admin/Models/Affiliates/AffiliateListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Affiliates/AffiliateListModel.cs
@@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Affiliates
{
- public partial class AffiliateListModel : BaseModel
+ public class AffiliateListModel : BaseModel
{
[GrandResourceDisplayName("Admin.Affiliates.List.SearchFirstName")]
diff --git a/src/Web/Grand.Web.Admin/Models/Affiliates/AffiliateModel.cs b/src/Web/Grand.Web.Admin/Models/Affiliates/AffiliateModel.cs
index 9d4dafb02..be2b15080 100644
--- a/src/Web/Grand.Web.Admin/Models/Affiliates/AffiliateModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Affiliates/AffiliateModel.cs
@@ -4,7 +4,7 @@ using Grand.Infrastructure.ModelBinding;
namespace Grand.Web.Admin.Models.Affiliates
{
- public partial class AffiliateModel : BaseEntityModel
+ public class AffiliateModel : BaseEntityModel
{
public AffiliateModel()
{
@@ -36,7 +36,7 @@ namespace Grand.Web.Admin.Models.Affiliates
#region Nested classes
- public partial class AffiliatedOrderModel : BaseEntityModel
+ public class AffiliatedOrderModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Affiliates.Orders.Order")]
public override string Id { get; set; }
@@ -60,7 +60,7 @@ namespace Grand.Web.Admin.Models.Affiliates
public DateTime CreatedOn { get; set; }
}
- public partial class AffiliatedCustomerModel : BaseEntityModel
+ public class AffiliatedCustomerModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Affiliates.Customers.Name")]
public string Name { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Affiliates/AffiliatedOrderListModel.cs b/src/Web/Grand.Web.Admin/Models/Affiliates/AffiliatedOrderListModel.cs
index 5b16eb5f3..2bd59a3db 100644
--- a/src/Web/Grand.Web.Admin/Models/Affiliates/AffiliatedOrderListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Affiliates/AffiliatedOrderListModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Affiliates
{
- public partial class AffiliatedOrderListModel : BaseModel
+ public class AffiliatedOrderListModel : BaseModel
{
public AffiliatedOrderListModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Blogs/BlogCategoryModel.cs b/src/Web/Grand.Web.Admin/Models/Blogs/BlogCategoryModel.cs
index cc73f2f6d..72464531a 100644
--- a/src/Web/Grand.Web.Admin/Models/Blogs/BlogCategoryModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Blogs/BlogCategoryModel.cs
@@ -7,7 +7,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Blogs
{
- public partial class BlogCategoryModel : BaseEntityModel, ILocalizedModel<BlogCategoryLocalizedModel>, IStoreLinkModel
+ public class BlogCategoryModel : BaseEntityModel, ILocalizedModel<BlogCategoryLocalizedModel>, IStoreLinkModel
{
public BlogCategoryModel()
{
@@ -27,14 +27,14 @@ namespace Grand.Web.Admin.Models.Blogs
[UIHint("Stores")]
public string[] Stores { get; set; }
}
- public partial class BlogCategoryLocalizedModel : ILocalizedModelLocal
+ public class BlogCategoryLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
[GrandResourceDisplayName("Admin.Content.Blog.BlogCategory.Fields.Name")]
public string Name { get; set; }
}
- public partial class AddBlogPostCategoryModel : BaseModel
+ public class AddBlogPostCategoryModel : BaseModel
{
public AddBlogPostCategoryModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Blogs/BlogCommentModel.cs b/src/Web/Grand.Web.Admin/Models/Blogs/BlogCommentModel.cs
index cfc19f0ea..603ed0707 100644
--- a/src/Web/Grand.Web.Admin/Models/Blogs/BlogCommentModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Blogs/BlogCommentModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Blogs
{
- public partial class BlogCommentModel : BaseEntityModel
+ public class BlogCommentModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Content.Blog.Comments.Fields.BlogPost")]
public string BlogPostId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Blogs/BlogPostModel.cs b/src/Web/Grand.Web.Admin/Models/Blogs/BlogPostModel.cs
index eb7032c5a..9106ac274 100644
--- a/src/Web/Grand.Web.Admin/Models/Blogs/BlogPostModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Blogs/BlogPostModel.cs
@@ -6,7 +6,7 @@ using Grand.Web.Common.Models;
namespace Grand.Web.Admin.Models.Blogs
{
- public partial class BlogPostModel : BaseEntityModel, ILocalizedModel<BlogLocalizedModel>, IStoreLinkModel
+ public class BlogPostModel : BaseEntityModel, ILocalizedModel<BlogLocalizedModel>, IStoreLinkModel
{
public BlogPostModel()
{
@@ -78,7 +78,7 @@ namespace Grand.Web.Admin.Models.Blogs
}
- public partial class BlogLocalizedModel : ILocalizedModelLocal, ISlugModelLocal
+ public class BlogLocalizedModel : ILocalizedModelLocal, ISlugModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Blogs/BlogProductModel.cs b/src/Web/Grand.Web.Admin/Models/Blogs/BlogProductModel.cs
index 7523a2f75..3c50a0443 100644
--- a/src/Web/Grand.Web.Admin/Models/Blogs/BlogProductModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Blogs/BlogProductModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Blogs
{
- public partial class BlogProductModel : BaseEntityModel
+ public class BlogProductModel : BaseEntityModel
{
public string ProductId { get; set; }
@@ -15,7 +15,7 @@ namespace Grand.Web.Admin.Models.Blogs
[GrandResourceDisplayName("Admin.Content.Blog.Product.Fields.DisplayOrder")]
public int DisplayOrder { get; set; }
- public partial class AddProductModel : BaseModel
+ public class AddProductModel : BaseModel
{
public AddProductModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/BrandListModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/BrandListModel.cs
index a5ff276de..4a555ecbe 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/BrandListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/BrandListModel.cs
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Models.Catalog
{
- public partial class BrandListModel : BaseModel
+ public class BrandListModel : BaseModel
{
public BrandListModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/BrandModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/BrandModel.cs
index ddd9265b1..b6d38ad9f 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/BrandModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/BrandModel.cs
@@ -8,7 +8,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Catalog
{
- public partial class BrandModel : BaseEntityModel, ILocalizedModel<BrandLocalizedModel>, IGroupLinkModel, IStoreLinkModel
+ public class BrandModel : BaseEntityModel, ILocalizedModel<BrandLocalizedModel>, IGroupLinkModel, IStoreLinkModel
{
public BrandModel()
{
@@ -99,7 +99,7 @@ namespace Grand.Web.Admin.Models.Catalog
#region Nested classes
- public partial class ActivityLogModel : BaseEntityModel
+ public class ActivityLogModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Catalog.Brands.ActivityLog.ActivityLogType")]
public string ActivityLogTypeName { get; set; }
@@ -115,7 +115,7 @@ namespace Grand.Web.Admin.Models.Catalog
#endregion
}
- public partial class BrandLocalizedModel : ILocalizedModelLocal, ISlugModelLocal
+ public class BrandLocalizedModel : ILocalizedModelLocal, ISlugModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/BulkEditListModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/BulkEditListModel.cs
index f8f0d1e1d..4676a5301 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/BulkEditListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/BulkEditListModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Catalog
{
- public partial class BulkEditListModel : BaseModel
+ public class BulkEditListModel : BaseModel
{
public BulkEditListModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/BulkEditProductModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/BulkEditProductModel.cs
index 4b98668f2..41030554c 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/BulkEditProductModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/BulkEditProductModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Catalog
{
- public partial class BulkEditProductModel : BaseEntityModel
+ public class BulkEditProductModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Catalog.BulkEdit.Fields.Name")]
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/CategoryListModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/CategoryListModel.cs
index fa7517a5b..cd2d69b22 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/CategoryListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/CategoryListModel.cs
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Models.Catalog
{
- public partial class CategoryListModel : BaseModel
+ public class CategoryListModel : BaseModel
{
public CategoryListModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/CategoryModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/CategoryModel.cs
index d55fdca28..8944bae3b 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/CategoryModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/CategoryModel.cs
@@ -8,7 +8,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Catalog
{
- public partial class CategoryModel : BaseEntityModel, ILocalizedModel<CategoryLocalizedModel>, IGroupLinkModel, IStoreLinkModel
+ public class CategoryModel : BaseEntityModel, ILocalizedModel<CategoryLocalizedModel>, IGroupLinkModel, IStoreLinkModel
{
public CategoryModel()
{
@@ -125,7 +125,7 @@ namespace Grand.Web.Admin.Models.Catalog
#region Nested classes
- public partial class CategoryProductModel : BaseEntityModel
+ public class CategoryProductModel : BaseEntityModel
{
public string CategoryId { get; set; }
@@ -140,7 +140,7 @@ namespace Grand.Web.Admin.Models.Catalog
[GrandResourceDisplayName("Admin.Catalog.Categories.Products.Fields.DisplayOrder")]
public int DisplayOrder { get; set; }
}
- public partial class AddCategoryProductModel : BaseModel
+ public class AddCategoryProductModel : BaseModel
{
public AddCategoryProductModel()
{
@@ -177,7 +177,7 @@ namespace Grand.Web.Admin.Models.Catalog
public string[] SelectedProductIds { get; set; }
}
- public partial class ActivityLogModel : BaseEntityModel
+ public class ActivityLogModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Catalog.Categories.ActivityLogType")]
public string ActivityLogTypeName { get; set; }
@@ -193,7 +193,7 @@ namespace Grand.Web.Admin.Models.Catalog
#endregion
}
- public partial class CategoryLocalizedModel : ILocalizedModelLocal, ISlugModelLocal
+ public class CategoryLocalizedModel : ILocalizedModelLocal, ISlugModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/CollectionListModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/CollectionListModel.cs
index 38808e12f..b3f866309 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/CollectionListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/CollectionListModel.cs
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Models.Catalog
{
- public partial class CollectionListModel : BaseModel
+ public class CollectionListModel : BaseModel
{
public CollectionListModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/CollectionModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/CollectionModel.cs
index 83e017a5c..6a32923a4 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/CollectionModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/CollectionModel.cs
@@ -8,7 +8,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Catalog
{
- public partial class CollectionModel : BaseEntityModel, ILocalizedModel<CollectionLocalizedModel>, IGroupLinkModel, IStoreLinkModel
+ public class CollectionModel : BaseEntityModel, ILocalizedModel<CollectionLocalizedModel>, IGroupLinkModel, IStoreLinkModel
{
public CollectionModel()
{
@@ -101,7 +101,7 @@ namespace Grand.Web.Admin.Models.Catalog
#region Nested classes
- public partial class CollectionProductModel : BaseEntityModel
+ public class CollectionProductModel : BaseEntityModel
{
public string CollectionId { get; set; }
@@ -117,7 +117,7 @@ namespace Grand.Web.Admin.Models.Catalog
public int DisplayOrder { get; set; }
}
- public partial class AddCollectionProductModel : BaseModel
+ public class AddCollectionProductModel : BaseModel
{
public AddCollectionProductModel()
{
@@ -155,7 +155,7 @@ namespace Grand.Web.Admin.Models.Catalog
public string[] SelectedProductIds { get; set; }
}
- public partial class ActivityLogModel : BaseEntityModel
+ public class ActivityLogModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Catalog.Collections.ActivityLog.ActivityLogType")]
public string ActivityLogTypeName { get; set; }
@@ -173,7 +173,7 @@ namespace Grand.Web.Admin.Models.Catalog
#endregion
}
- public partial class CollectionLocalizedModel : ILocalizedModelLocal, ISlugModelLocal
+ public class CollectionLocalizedModel : ILocalizedModelLocal, ISlugModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/CopyProductModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/CopyProductModel.cs
index cea0d8b6f..e8b873e59 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/CopyProductModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/CopyProductModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Catalog
{
- public partial class CopyProductModel : BaseEntityModel
+ public class CopyProductModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Catalog.Products.Copy.Name")]
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/LowStockProductModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/LowStockProductModel.cs
index f6c811ad0..f6f6f9e29 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/LowStockProductModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/LowStockProductModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Catalog
{
- public partial class LowStockProductModel : BaseEntityModel
+ public class LowStockProductModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Catalog.Products.Fields.Name")]
public string Name { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/ProductAttributeCombinationModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/ProductAttributeCombinationModel.cs
index 43ea1c333..f736163e3 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/ProductAttributeCombinationModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/ProductAttributeCombinationModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Catalog
{
- public partial class ProductAttributeCombinationModel : BaseModel
+ public class ProductAttributeCombinationModel : BaseModel
{
public string Id { get; set; }
@@ -65,7 +65,7 @@ namespace Grand.Web.Admin.Models.Catalog
#region Nested classes
- public partial class ProductAttributeModel : BaseEntityModel
+ public class ProductAttributeModel : BaseEntityModel
{
public ProductAttributeModel()
{
@@ -80,14 +80,14 @@ namespace Grand.Web.Admin.Models.Catalog
public IList<ProductAttributeValueModel> Values { get; set; }
}
- public partial class ProductAttributeValueModel : BaseEntityModel
+ public class ProductAttributeValueModel : BaseEntityModel
{
public string Name { get; set; }
public bool IsPreSelected { get; set; }
}
- public partial class WarehouseInventoryModel : BaseEntityModel
+ public class WarehouseInventoryModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Catalog.Products.ProductAttributes.AttributeCombination.WarehouseInventory.Fields.Warehouse")]
public string WarehouseId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/ProductAttributeConditionModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/ProductAttributeConditionModel.cs
index 183018a15..ce4610993 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/ProductAttributeConditionModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/ProductAttributeConditionModel.cs
@@ -4,7 +4,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Catalog
{
- public partial class ProductAttributeConditionModel : BaseModel
+ public class ProductAttributeConditionModel : BaseModel
{
public ProductAttributeConditionModel()
{
@@ -23,7 +23,7 @@ namespace Grand.Web.Admin.Models.Catalog
#region Nested classes
- public partial class ProductAttributeModel : BaseEntityModel
+ public class ProductAttributeModel : BaseEntityModel
{
public ProductAttributeModel()
{
@@ -43,7 +43,7 @@ namespace Grand.Web.Admin.Models.Catalog
public IList<ProductAttributeValueModel> Values { get; set; }
}
- public partial class ProductAttributeValueModel : BaseEntityModel
+ public class ProductAttributeValueModel : BaseEntityModel
{
public string Name { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/ProductAttributeModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/ProductAttributeModel.cs
index 6e70c3c10..9b3f94d11 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/ProductAttributeModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/ProductAttributeModel.cs
@@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Catalog
{
- public partial class ProductAttributeModel : BaseEntityModel, ILocalizedModel<ProductAttributeLocalizedModel>, IStoreLinkModel
+ public class ProductAttributeModel : BaseEntityModel, ILocalizedModel<ProductAttributeLocalizedModel>, IStoreLinkModel
{
public ProductAttributeModel()
{
@@ -31,7 +31,7 @@ namespace Grand.Web.Admin.Models.Catalog
#region Nested classes
- public partial class UsedByProductModel : BaseEntityModel
+ public class UsedByProductModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Catalog.Attributes.ProductAttributes.UsedByProducts.Product")]
public string ProductName { get; set; }
@@ -42,7 +42,7 @@ namespace Grand.Web.Admin.Models.Catalog
#endregion
}
- public partial class ProductAttributeLocalizedModel : ILocalizedModelLocal
+ public class ProductAttributeLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
@@ -55,7 +55,7 @@ namespace Grand.Web.Admin.Models.Catalog
public string Description { get; set; }
}
- public partial class PredefinedProductAttributeValueModel : BaseEntityModel, ILocalizedModel<PredefinedProductAttributeValueLocalizedModel>
+ public class PredefinedProductAttributeValueModel : BaseEntityModel, ILocalizedModel<PredefinedProductAttributeValueLocalizedModel>
{
public PredefinedProductAttributeValueModel()
{
@@ -91,7 +91,7 @@ namespace Grand.Web.Admin.Models.Catalog
public IList<PredefinedProductAttributeValueLocalizedModel> Locales { get; set; }
}
- public partial class PredefinedProductAttributeValueLocalizedModel : ILocalizedModelLocal
+ public class PredefinedProductAttributeValueLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/ProductListModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/ProductListModel.cs
index e0d91a664..ad60d9480 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/ProductListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/ProductListModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Catalog
{
- public partial class ProductListModel : BaseModel
+ public class ProductListModel : BaseModel
{
public ProductListModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/ProductModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/ProductModel.cs
index 59d18b3bd..38b5bee1b 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/ProductModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/ProductModel.cs
@@ -9,7 +9,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Catalog
{
- public partial class ProductModel : BaseEntityModel, ILocalizedModel<ProductLocalizedModel>, IGroupLinkModel, IStoreLinkModel
+ public class ProductModel : BaseEntityModel, ILocalizedModel<ProductLocalizedModel>, IGroupLinkModel, IStoreLinkModel
{
public ProductModel()
{
@@ -411,7 +411,7 @@ namespace Grand.Web.Admin.Models.Catalog
#region Nested classes
- public partial class AddProductModel : BaseModel
+ public class AddProductModel : BaseModel
{
public AddProductModel()
{
@@ -448,12 +448,12 @@ namespace Grand.Web.Admin.Models.Catalog
}
- public partial class AddRequiredProductModel : AddProductModel
+ public class AddRequiredProductModel : AddProductModel
{
}
- public partial class AddProductSpecificationAttributeModel : BaseModel
+ public class AddProductSpecificationAttributeModel : BaseModel
{
public AddProductSpecificationAttributeModel()
{
@@ -492,7 +492,7 @@ namespace Grand.Web.Admin.Models.Catalog
public IList<SelectListItem> AvailableOptions { get; set; }
}
- public partial class ProductPictureModel : BaseEntityModel, ILocalizedModel<ProductPictureModel.ProductPictureLocalizedModel>
+ public class ProductPictureModel : BaseEntityModel, ILocalizedModel<ProductPictureModel.ProductPictureLocalizedModel>
{
public ProductPictureModel()
{
@@ -525,7 +525,7 @@ namespace Grand.Web.Admin.Models.Catalog
public IList<ProductPictureLocalizedModel> Locales { get; set; }
- public partial class ProductPictureLocalizedModel : ILocalizedModelLocal
+ public class ProductPictureLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
@@ -539,7 +539,7 @@ namespace Grand.Web.Admin.Models.Catalog
}
- public partial class ProductCategoryModel : BaseEntityModel
+ public class ProductCategoryModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Catalog.Products.Categories.Fields.Category")]
public string Category { get; set; }
@@ -555,7 +555,7 @@ namespace Grand.Web.Admin.Models.Catalog
public int DisplayOrder { get; set; }
}
- public partial class ProductCollectionModel : BaseEntityModel
+ public class ProductCollectionModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Catalog.Products.Collections.Fields.Collection")]
public string Collection { get; set; }
@@ -571,7 +571,7 @@ namespace Grand.Web.Admin.Models.Catalog
public int DisplayOrder { get; set; }
}
- public partial class RelatedProductModel : BaseEntityModel
+ public class RelatedProductModel : BaseEntityModel
{
public string ProductId1 { get; set; }
public string ProductId2 { get; set; }
@@ -582,13 +582,13 @@ namespace Grand.Web.Admin.Models.Catalog
[GrandResourceDisplayName("Admin.Catalog.Products.RelatedProducts.Fields.DisplayOrder")]
public int DisplayOrder { get; set; }
}
- public partial class AddRelatedProductModel : AddProductModel
+ public class AddRelatedProductModel : AddProductModel
{
public string ProductId { get; set; }
public string[] SelectedProductIds { get; set; }
}
- public partial class SimilarProductModel : BaseEntityModel
+ public class SimilarProductModel : BaseEntityModel
{
public string ProductId1 { get; set; }
public string ProductId2 { get; set; }
@@ -600,14 +600,14 @@ namespace Grand.Web.Admin.Models.Catalog
public int DisplayOrder { get; set; }
}
- public partial class AddSimilarProductModel : AddProductModel
+ public class AddSimilarProductModel : AddProductModel
{
public string ProductId { get; set; }
public string[] SelectedProductIds { get; set; }
}
- public partial class BundleProductModel : BaseEntityModel
+ public class BundleProductModel : BaseEntityModel
{
public string ProductBundleId { get; set; }
public string ProductId { get; set; }
@@ -622,14 +622,14 @@ namespace Grand.Web.Admin.Models.Catalog
public int DisplayOrder { get; set; }
}
- public partial class AddBundleProductModel : AddProductModel
+ public class AddBundleProductModel : AddProductModel
{
public string ProductId { get; set; }
public string[] SelectedProductIds { get; set; }
}
- public partial class AssociatedProductModel : BaseEntityModel
+ public class AssociatedProductModel : BaseEntityModel
{
public string ProductId { get; set; }
[GrandResourceDisplayName("Admin.Catalog.Products.AssociatedProducts.Fields.Product")]
@@ -638,14 +638,14 @@ namespace Grand.Web.Admin.Models.Catalog
public int DisplayOrder { get; set; }
}
- public partial class AddAssociatedProductModel : AddProductModel
+ public class AddAssociatedProductModel : AddProductModel
{
public string ProductId { get; set; }
public string[] SelectedProductIds { get; set; }
}
- public partial class CrossSellProductModel : BaseEntityModel
+ public class CrossSellProductModel : BaseEntityModel
{
public string ProductId { get; set; }
@@ -653,35 +653,35 @@ namespace Grand.Web.Admin.Models.Catalog
public string Product2Name { get; set; }
}
- public partial class AddCrossSellProductModel : AddProductModel
+ public class AddCrossSellProductModel : AddProductModel
{
public string ProductId { get; set; }
public string[] SelectedProductIds { get; set; }
}
- public partial class RecommendedProductModel : BaseEntityModel
+ public class RecommendedProductModel : BaseEntityModel
{
public string ProductId { get; set; }
[GrandResourceDisplayName("Admin.Catalog.Products.Recommended.Fields.Product")]
public string Product2Name { get; set; }
}
- public partial class AddRecommendedProductModel : AddProductModel
+ public class AddRecommendedProductModel : AddProductModel
{
public string ProductId { get; set; }
public string[] SelectedProductIds { get; set; }
}
- public partial class ProductPriceModel : BaseEntityModel
+ public class ProductPriceModel : BaseEntityModel
{
public string CurrencyCode { get; set; }
public double Price { get; set; }
}
- public partial class TierPriceModel : BaseEntityModel
+ public class TierPriceModel : BaseEntityModel
{
public TierPriceModel()
@@ -722,7 +722,7 @@ namespace Grand.Web.Admin.Models.Catalog
}
- public partial class ProductWarehouseInventoryModel : BaseModel
+ public class ProductWarehouseInventoryModel : BaseModel
{
[GrandResourceDisplayName("Admin.Catalog.Products.ProductWarehouseInventory.Fields.Warehouse")]
public string WarehouseId { get; set; }
@@ -737,7 +737,7 @@ namespace Grand.Web.Admin.Models.Catalog
public int ReservedQuantity { get; set; }
}
- public partial class ReservationModel : BaseEntityModel
+ public class ReservationModel : BaseEntityModel
{
public string ReservationId { get; set; }
public DateTime Date { get; set; }
@@ -748,7 +748,7 @@ namespace Grand.Web.Admin.Models.Catalog
public string Duration { get; set; }
}
- public partial class BidModel : BaseEntityModel
+ public class BidModel : BaseEntityModel
{
public string ProductId { get; set; }
public string BidId { get; set; }
@@ -759,7 +759,7 @@ namespace Grand.Web.Admin.Models.Catalog
public string OrderId { get; set; }
}
- public partial class GenerateCalendarModel : BaseModel
+ public class GenerateCalendarModel : BaseModel
{
public GenerateCalendarModel()
@@ -824,7 +824,7 @@ namespace Grand.Web.Admin.Models.Catalog
}
- public partial class ProductAttributeMappingModel : BaseEntityModel
+ public class ProductAttributeMappingModel : BaseEntityModel
{
public ProductAttributeMappingModel()
{
@@ -887,7 +887,7 @@ namespace Grand.Web.Admin.Models.Catalog
public bool ConditionAllowed { get; set; }
public string ConditionString { get; set; }
}
- public partial class ProductAttributeValueListModel : BaseModel
+ public class ProductAttributeValueListModel : BaseModel
{
public string ProductId { get; set; }
@@ -898,7 +898,7 @@ namespace Grand.Web.Admin.Models.Catalog
public string ProductAttributeName { get; set; }
}
- public partial class ProductAttributeValueModel : BaseEntityModel, ILocalizedModel<ProductAttributeValueLocalizedModel>
+ public class ProductAttributeValueModel : BaseEntityModel, ILocalizedModel<ProductAttributeValueLocalizedModel>
{
public ProductAttributeValueModel()
{
@@ -967,7 +967,7 @@ namespace Grand.Web.Admin.Models.Catalog
#region Nested classes
- public partial class AssociateProductToAttributeValueModel : AddProductModel
+ public class AssociateProductToAttributeValueModel : AddProductModel
{
public string AssociatedToProductId { get; set; }
}
@@ -975,7 +975,7 @@ namespace Grand.Web.Admin.Models.Catalog
#endregion
}
- public partial class ActivityLogModel : BaseEntityModel
+ public class ActivityLogModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Catalog.Products.ActivityLog.ActivityLogType")]
public string ActivityLogTypeName { get; set; }
@@ -987,7 +987,7 @@ namespace Grand.Web.Admin.Models.Catalog
public string CustomerId { get; set; }
public string CustomerEmail { get; set; }
}
- public partial class ProductAttributeValueLocalizedModel : ILocalizedModelLocal
+ public class ProductAttributeValueLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
@@ -995,7 +995,7 @@ namespace Grand.Web.Admin.Models.Catalog
public string Name { get; set; }
}
- public partial class ProductAttributeCombinationModel : BaseEntityModel
+ public class ProductAttributeCombinationModel : BaseEntityModel
{
public string ProductId { get; set; }
@@ -1027,7 +1027,7 @@ namespace Grand.Web.Admin.Models.Catalog
public int NotifyAdminForQuantityBelow { get; set; }
}
- public partial class ProductAttributeCombinationTierPricesModel : BaseEntityModel
+ public class ProductAttributeCombinationTierPricesModel : BaseEntityModel
{
public string StoreId { get; set; }
public string Store { get; set; }
@@ -1052,7 +1052,7 @@ namespace Grand.Web.Admin.Models.Catalog
#endregion
}
- public partial class ProductLocalizedModel : ILocalizedModelLocal, ISlugModelLocal
+ public class ProductLocalizedModel : ILocalizedModelLocal, ISlugModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/ProductReviewListModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/ProductReviewListModel.cs
index bcc132917..993c4aa34 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/ProductReviewListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/ProductReviewListModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Catalog
{
- public partial class ProductReviewListModel : BaseModel
+ public class ProductReviewListModel : BaseModel
{
public ProductReviewListModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/ProductReviewModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/ProductReviewModel.cs
index e7cf9c25c..4c1bae727 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/ProductReviewModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/ProductReviewModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Catalog
{
- public partial class ProductReviewModel : BaseEntityModel
+ public class ProductReviewModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Catalog.ProductReviews.Fields.Product")]
public string ProductId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/ProductSpecificationAttributeModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/ProductSpecificationAttributeModel.cs
index 9fdff1f16..e08eb58f3 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/ProductSpecificationAttributeModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/ProductSpecificationAttributeModel.cs
@@ -2,7 +2,7 @@
namespace Grand.Web.Admin.Models.Catalog
{
- public partial class ProductSpecificationAttributeModel : BaseEntityModel
+ public class ProductSpecificationAttributeModel : BaseEntityModel
{
public int AttributeTypeId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/ProductTagModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/ProductTagModel.cs
index 8274c937c..a6697cfbf 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/ProductTagModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/ProductTagModel.cs
@@ -4,7 +4,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Catalog
{
- public partial class ProductTagModel : BaseEntityModel, ILocalizedModel<ProductTagLocalizedModel>
+ public class ProductTagModel : BaseEntityModel, ILocalizedModel<ProductTagLocalizedModel>
{
public ProductTagModel()
{
@@ -20,7 +20,7 @@ namespace Grand.Web.Admin.Models.Catalog
public IList<ProductTagLocalizedModel> Locales { get; set; }
}
- public partial class ProductTagLocalizedModel : ILocalizedModelLocal
+ public class ProductTagLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/SpecificationAttributeModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/SpecificationAttributeModel.cs
index ce837c5c0..939a39bb7 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/SpecificationAttributeModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/SpecificationAttributeModel.cs
@@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Catalog
{
- public partial class SpecificationAttributeModel : BaseEntityModel, ILocalizedModel<SpecificationAttributeLocalizedModel>, IStoreLinkModel
+ public class SpecificationAttributeModel : BaseEntityModel, ILocalizedModel<SpecificationAttributeLocalizedModel>, IStoreLinkModel
{
public SpecificationAttributeModel()
{
@@ -29,7 +29,7 @@ namespace Grand.Web.Admin.Models.Catalog
public IList<SpecificationAttributeLocalizedModel> Locales { get; set; }
- public partial class UsedByProductModel : BaseEntityModel
+ public class UsedByProductModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Catalog.Attributes.SpecificationAttributes.UsedByProducts.Product")]
public string ProductName { get; set; }
@@ -40,7 +40,7 @@ namespace Grand.Web.Admin.Models.Catalog
}
}
- public partial class SpecificationAttributeLocalizedModel : ILocalizedModelLocal
+ public class SpecificationAttributeLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Catalog/SpecificationAttributeOptionModel.cs b/src/Web/Grand.Web.Admin/Models/Catalog/SpecificationAttributeOptionModel.cs
index c61c95334..6c9ad692b 100644
--- a/src/Web/Grand.Web.Admin/Models/Catalog/SpecificationAttributeOptionModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Catalog/SpecificationAttributeOptionModel.cs
@@ -4,7 +4,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Catalog
{
- public partial class SpecificationAttributeOptionModel : BaseEntityModel, ILocalizedModel<SpecificationAttributeOptionLocalizedModel>
+ public class SpecificationAttributeOptionModel : BaseEntityModel, ILocalizedModel<SpecificationAttributeOptionLocalizedModel>
{
public SpecificationAttributeOptionModel()
{
@@ -34,7 +34,7 @@ namespace Grand.Web.Admin.Models.Catalog
}
- public partial class SpecificationAttributeOptionLocalizedModel : ILocalizedModelLocal
+ public class SpecificationAttributeOptionLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Cms/AdminWidgetModel.cs b/src/Web/Grand.Web.Admin/Models/Cms/AdminWidgetModel.cs
index 45cee252f..eed225e77 100644
--- a/src/Web/Grand.Web.Admin/Models/Cms/AdminWidgetModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Cms/AdminWidgetModel.cs
@@ -2,7 +2,7 @@
namespace Grand.Web.Admin.Models.Cms
{
- public partial class AdminWidgetModel : BaseModel
+ public class AdminWidgetModel : BaseModel
{
public string WidgetZone { get; set; }
public string ViewComponentName { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Cms/WidgetModel.cs b/src/Web/Grand.Web.Admin/Models/Cms/WidgetModel.cs
index 79a6841a3..e8a764fdc 100644
--- a/src/Web/Grand.Web.Admin/Models/Cms/WidgetModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Cms/WidgetModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Cms
{
- public partial class WidgetModel : BaseModel
+ public class WidgetModel : BaseModel
{
[GrandResourceDisplayName("Admin.Plugins.Widgets.Fields.FriendlyName")]
diff --git a/src/Web/Grand.Web.Admin/Models/Common/AddressAttributeModel.cs b/src/Web/Grand.Web.Admin/Models/Common/AddressAttributeModel.cs
index 0001950ee..d59262a8f 100644
--- a/src/Web/Grand.Web.Admin/Models/Common/AddressAttributeModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Common/AddressAttributeModel.cs
@@ -4,7 +4,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Common
{
- public partial class AddressAttributeModel : BaseEntityModel, ILocalizedModel<AddressAttributeLocalizedModel>
+ public class AddressAttributeModel : BaseEntityModel, ILocalizedModel<AddressAttributeLocalizedModel>
{
public AddressAttributeModel()
{
@@ -32,7 +32,7 @@ namespace Grand.Web.Admin.Models.Common
}
- public partial class AddressAttributeLocalizedModel : ILocalizedModelLocal
+ public class AddressAttributeLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Common/AddressAttributeValueModel.cs b/src/Web/Grand.Web.Admin/Models/Common/AddressAttributeValueModel.cs
index 30b76175b..a86442bcc 100644
--- a/src/Web/Grand.Web.Admin/Models/Common/AddressAttributeValueModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Common/AddressAttributeValueModel.cs
@@ -4,7 +4,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Common
{
- public partial class AddressAttributeValueModel : BaseEntityModel, ILocalizedModel<AddressAttributeValueLocalizedModel>
+ public class AddressAttributeValueModel : BaseEntityModel, ILocalizedModel<AddressAttributeValueLocalizedModel>
{
public AddressAttributeValueModel()
{
@@ -27,7 +27,7 @@ namespace Grand.Web.Admin.Models.Common
}
- public partial class AddressAttributeValueLocalizedModel : ILocalizedModelLocal
+ public class AddressAttributeValueLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Common/AddressModel.cs b/src/Web/Grand.Web.Admin/Models/Common/AddressModel.cs
index cc6d87e95..3f2c7360f 100644
--- a/src/Web/Grand.Web.Admin/Models/Common/AddressModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Common/AddressModel.cs
@@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Models.Common
{
- public partial class AddressModel : BaseEntityModel
+ public class AddressModel : BaseEntityModel
{
public AddressModel()
{
@@ -113,7 +113,7 @@ namespace Grand.Web.Admin.Models.Common
#region Nested classes
- public partial class AddressAttributeModel : BaseEntityModel
+ public class AddressAttributeModel : BaseEntityModel
{
public AddressAttributeModel()
{
@@ -134,7 +134,7 @@ namespace Grand.Web.Admin.Models.Common
public IList<AddressAttributeValueModel> Values { get; set; }
}
- public partial class AddressAttributeValueModel : BaseEntityModel
+ public class AddressAttributeValueModel : BaseEntityModel
{
public string Name { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Common/Editor.cs b/src/Web/Grand.Web.Admin/Models/Common/Editor.cs
index 93ac32ec7..23078eddd 100644
--- a/src/Web/Grand.Web.Admin/Models/Common/Editor.cs
+++ b/src/Web/Grand.Web.Admin/Models/Common/Editor.cs
@@ -1,7 +1,7 @@

namespace Grand.Web.Admin.Models.Common
{
- public partial class Editor
+ public class Editor
{
public string Content { get; set; }
}
diff --git a/src/Web/Grand.Web.Admin/Models/Common/GoogleAnalyticsResultModel.cs b/src/Web/Grand.Web.Admin/Models/Common/GoogleAnalyticsResultModel.cs
deleted file mode 100644
index d11ce47dc..000000000
--- a/src/Web/Grand.Web.Admin/Models/Common/GoogleAnalyticsResultModel.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-namespace Grand.Web.Admin.Models.Common
-{
- public partial class GoogleAnalyticsResultModel
- {
- public GoogleAnalyticsResultModel()
- {
- Records = new List<Dictionary<string, string>>();
- }
-
- /// <summary>
- /// Key: metric/dimension header,
- /// Value: metric/dimension value
- /// </summary>
- public List<Dictionary<string, string>> Records { get; private set; }
- public string StartDate { get; set; }
- public string EndDate { get; set; }
- public string Message { get; set; }
- }
-}
diff --git a/src/Web/Grand.Web.Admin/Models/Common/LanguageSelectorModel.cs b/src/Web/Grand.Web.Admin/Models/Common/LanguageSelectorModel.cs
index 1cb26d08d..e7d8db832 100644
--- a/src/Web/Grand.Web.Admin/Models/Common/LanguageSelectorModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Common/LanguageSelectorModel.cs
@@ -3,7 +3,7 @@ using Grand.Web.Admin.Models.Localization;
namespace Grand.Web.Admin.Models.Common
{
- public partial class LanguageSelectorModel : BaseModel
+ public class LanguageSelectorModel : BaseModel
{
public LanguageSelectorModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Common/LoginModel.cs b/src/Web/Grand.Web.Admin/Models/Common/LoginModel.cs
index 3707c1da4..daf4d05c0 100644
--- a/src/Web/Grand.Web.Admin/Models/Common/LoginModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Common/LoginModel.cs
@@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Common
{
- public partial class LoginModel : BaseModel
+ public class LoginModel : BaseModel
{
public LoginModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Common/MaintenanceModel.cs b/src/Web/Grand.Web.Admin/Models/Common/MaintenanceModel.cs
index 74a72aaff..b06122488 100644
--- a/src/Web/Grand.Web.Admin/Models/Common/MaintenanceModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Common/MaintenanceModel.cs
@@ -4,14 +4,14 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Common
{
- public partial class MaintenanceModel : BaseModel
+ public class MaintenanceModel : BaseModel
{
public MaintenanceModel()
{
DeleteGuests = new DeleteGuestsModel();
DeleteAbandonedCarts = new DeleteAbandonedCartsModel();
DeleteExportedFiles = new DeleteExportedFilesModel();
- ConvertedPictureModel = new ConvertPictureModel() { NumberOfConvertItems = -1 };
+ ConvertedPictureModel = new ConvertPictureModel { NumberOfConvertItems = -1 };
}
public DeleteGuestsModel DeleteGuests { get; set; }
@@ -24,7 +24,7 @@ namespace Grand.Web.Admin.Models.Common
#region Nested classes
- public partial class DeleteGuestsModel : BaseModel
+ public class DeleteGuestsModel : BaseModel
{
[GrandResourceDisplayName("Admin.System.Maintenance.DeleteGuests.StartDate")]
[UIHint("DateNullable")]
@@ -40,7 +40,7 @@ namespace Grand.Web.Admin.Models.Common
public int? NumberOfDeletedCustomers { get; set; }
}
- public partial class DeleteAbandonedCartsModel : BaseModel
+ public class DeleteAbandonedCartsModel : BaseModel
{
[GrandResourceDisplayName("Admin.System.Maintenance.DeleteAbandonedCarts.OlderThan")]
[UIHint("Date")]
@@ -49,7 +49,7 @@ namespace Grand.Web.Admin.Models.Common
public int? NumberOfDeletedItems { get; set; }
}
- public partial class DeleteExportedFilesModel : BaseModel
+ public class DeleteExportedFilesModel : BaseModel
{
[GrandResourceDisplayName("Admin.System.Maintenance.DeleteExportedFiles.StartDate")]
[UIHint("DateNullable")]
@@ -62,7 +62,7 @@ namespace Grand.Web.Admin.Models.Common
public int? NumberOfDeletedFiles { get; set; }
}
- public partial class ConvertPictureModel : BaseModel
+ public class ConvertPictureModel : BaseModel
{
public int NumberOfConvertItems { get; set; }
}
diff --git a/src/Web/Grand.Web.Admin/Models/Common/PictureModel.cs b/src/Web/Grand.Web.Admin/Models/Common/PictureModel.cs
index 5aa9ea08d..f295cad1b 100644
--- a/src/Web/Grand.Web.Admin/Models/Common/PictureModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Common/PictureModel.cs
@@ -4,7 +4,7 @@ using Grand.Web.Common.Models;
namespace Grand.Web.Admin.Models.Common
{
- public partial class PictureModel : BaseEntityModel, ILocalizedModel<PictureModel.PictureLocalizedModel>
+ public class PictureModel : BaseEntityModel, ILocalizedModel<PictureModel.PictureLocalizedModel>
{
public PictureModel()
{
@@ -30,7 +30,7 @@ namespace Grand.Web.Admin.Models.Common
public IList<PictureLocalizedModel> Locales { get; set; }
- public partial class PictureLocalizedModel : ILocalizedModelLocal
+ public class PictureLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Common/ReviewModel.cs b/src/Web/Grand.Web.Admin/Models/Common/ReviewModel.cs
index 6af4386b3..69bea83cc 100644
--- a/src/Web/Grand.Web.Admin/Models/Common/ReviewModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Common/ReviewModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Common
{
- public partial class ReviewModel : BaseEntityModel
+ public class ReviewModel : BaseEntityModel
{
/// <summary>
/// Gets or sets the title
diff --git a/src/Web/Grand.Web.Admin/Models/Common/SearchTermReportLineModel.cs b/src/Web/Grand.Web.Admin/Models/Common/SearchTermReportLineModel.cs
index 72efe40b9..da98b001f 100644
--- a/src/Web/Grand.Web.Admin/Models/Common/SearchTermReportLineModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Common/SearchTermReportLineModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Common
{
- public partial class SearchTermReportLineModel : BaseModel
+ public class SearchTermReportLineModel : BaseModel
{
[GrandResourceDisplayName("Admin.SearchTermReport.Keyword")]
public string Keyword { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Common/SystemInfoModel.cs b/src/Web/Grand.Web.Admin/Models/Common/SystemInfoModel.cs
index eef8adf15..d2872c17e 100644
--- a/src/Web/Grand.Web.Admin/Models/Common/SystemInfoModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Common/SystemInfoModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Common
{
- public partial class SystemInfoModel : BaseModel
+ public class SystemInfoModel : BaseModel
{
public SystemInfoModel()
{
@@ -65,19 +65,19 @@ namespace Grand.Web.Admin.Models.Common
public IList<SystemWarningModel> SystemWarnings { get; set; }
- public partial class ServerVariableModel : BaseModel
+ public class ServerVariableModel : BaseModel
{
public string Name { get; set; }
public string Value { get; set; }
}
- public partial class LoadedAssembly : BaseModel
+ public class LoadedAssembly : BaseModel
{
public string FullName { get; set; }
public string Location { get; set; }
}
- public partial class SystemWarningModel : BaseModel
+ public class SystemWarningModel : BaseModel
{
public SystemWarningLevel Level { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Common/UrlEntityListModel.cs b/src/Web/Grand.Web.Admin/Models/Common/UrlEntityListModel.cs
index d1a9ead98..99807ab4e 100644
--- a/src/Web/Grand.Web.Admin/Models/Common/UrlEntityListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Common/UrlEntityListModel.cs
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Models.Common
{
- public partial class UrlEntityListModel : BaseModel
+ public class UrlEntityListModel : BaseModel
{
public UrlEntityListModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Common/UrlEntityModel.cs b/src/Web/Grand.Web.Admin/Models/Common/UrlEntityModel.cs
index 882307730..778f28ff5 100644
--- a/src/Web/Grand.Web.Admin/Models/Common/UrlEntityModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Common/UrlEntityModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Common
{
- public partial class UrlEntityModel : BaseEntityModel
+ public class UrlEntityModel : BaseEntityModel
{
[GrandResourceDisplayName("admin.configuration.senames.Name")]
diff --git a/src/Web/Grand.Web.Admin/Models/Common/UserFieldModel.cs b/src/Web/Grand.Web.Admin/Models/Common/UserFieldModel.cs
index de70b24da..f55c3a127 100644
--- a/src/Web/Grand.Web.Admin/Models/Common/UserFieldModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Common/UserFieldModel.cs
@@ -1,6 +1,6 @@
namespace Grand.Web.Admin.Models.Common
{
- public partial class UserFieldModel
+ public class UserFieldModel
{
public string Id { get; set; }
public string ObjectType { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Country/CountriesListModel.cs b/src/Web/Grand.Web.Admin/Models/Country/CountriesListModel.cs
index efe0009d7..200fb9f0a 100644
--- a/src/Web/Grand.Web.Admin/Models/Country/CountriesListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Country/CountriesListModel.cs
@@ -3,10 +3,8 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Country
{
- public partial class CountriesListModel : BaseModel
+ public class CountriesListModel : BaseModel
{
- public CountriesListModel() { }
-
[GrandResourceDisplayName("Admin.Configuration.Countries.Fields.Name")]
public string CountryName { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Courses/CourseLessonModel.cs b/src/Web/Grand.Web.Admin/Models/Courses/CourseLessonModel.cs
index c10837fdd..ebb2115f3 100644
--- a/src/Web/Grand.Web.Admin/Models/Courses/CourseLessonModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Courses/CourseLessonModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Courses
{
- public partial class CourseLessonModel : BaseEntityModel
+ public class CourseLessonModel : BaseEntityModel
{
public CourseLessonModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Courses/CourseLevelModel.cs b/src/Web/Grand.Web.Admin/Models/Courses/CourseLevelModel.cs
index e8d6f4295..19024789a 100644
--- a/src/Web/Grand.Web.Admin/Models/Courses/CourseLevelModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Courses/CourseLevelModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Courses
{
- public partial class CourseLevelModel : BaseEntityModel
+ public class CourseLevelModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Courses.Level.Fields.Name")]
public string Name { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Courses/CourseModel.cs b/src/Web/Grand.Web.Admin/Models/Courses/CourseModel.cs
index eb16009bb..844246eb5 100644
--- a/src/Web/Grand.Web.Admin/Models/Courses/CourseModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Courses/CourseModel.cs
@@ -7,7 +7,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Courses
{
- public partial class CourseModel : BaseEntityModel, ILocalizedModel<CourseLocalizedModel>, IGroupLinkModel, IStoreLinkModel
+ public class CourseModel : BaseEntityModel, ILocalizedModel<CourseLocalizedModel>, IGroupLinkModel, IStoreLinkModel
{
public CourseModel()
{
@@ -71,7 +71,7 @@ namespace Grand.Web.Admin.Models.Courses
#region Nested classes
- public partial class AssociateProductToCourseModel : BaseModel
+ public class AssociateProductToCourseModel : BaseModel
{
public AssociateProductToCourseModel()
{
@@ -112,7 +112,7 @@ namespace Grand.Web.Admin.Models.Courses
#endregion
}
- public partial class CourseLocalizedModel : ILocalizedModelLocal, ISlugModelLocal
+ public class CourseLocalizedModel : ILocalizedModelLocal, ISlugModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Courses/CourseSubjectModel.cs b/src/Web/Grand.Web.Admin/Models/Courses/CourseSubjectModel.cs
index 8b18061c0..9cf94df1e 100644
--- a/src/Web/Grand.Web.Admin/Models/Courses/CourseSubjectModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Courses/CourseSubjectModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Courses
{
- public partial class CourseSubjectModel : BaseEntityModel
+ public class CourseSubjectModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Courses.Course.Subject.Fields.Name")]
public string Name { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Customers/BestCustomerReportLineModel.cs b/src/Web/Grand.Web.Admin/Models/Customers/BestCustomerReportLineModel.cs
index ab028b2be..d77abe3c1 100644
--- a/src/Web/Grand.Web.Admin/Models/Customers/BestCustomerReportLineModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Customers/BestCustomerReportLineModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Customers
{
- public partial class BestCustomerReportLineModel : BaseModel
+ public class BestCustomerReportLineModel : BaseModel
{
public string CustomerId { get; set; }
[GrandResourceDisplayName("Admin.Reports.Customers.BestBy.Fields.Customer")]
diff --git a/src/Web/Grand.Web.Admin/Models/Customers/BestCustomersReportModel.cs b/src/Web/Grand.Web.Admin/Models/Customers/BestCustomersReportModel.cs
index 0ed41289a..8c08973db 100644
--- a/src/Web/Grand.Web.Admin/Models/Customers/BestCustomersReportModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Customers/BestCustomersReportModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Customers
{
- public partial class BestCustomersReportModel : BaseModel
+ public class BestCustomersReportModel : BaseModel
{
public BestCustomersReportModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Customers/CustomerAddressModel.cs b/src/Web/Grand.Web.Admin/Models/Customers/CustomerAddressModel.cs
index 495fe8d5a..95495a47d 100644
--- a/src/Web/Grand.Web.Admin/Models/Customers/CustomerAddressModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Customers/CustomerAddressModel.cs
@@ -3,7 +3,7 @@ using Grand.Web.Admin.Models.Common;
namespace Grand.Web.Admin.Models.Customers
{
- public partial class CustomerAddressModel : BaseModel
+ public class CustomerAddressModel : BaseModel
{
public string CustomerId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Customers/CustomerAttributeModel.cs b/src/Web/Grand.Web.Admin/Models/Customers/CustomerAttributeModel.cs
index e87b5ab92..3f0d80821 100644
--- a/src/Web/Grand.Web.Admin/Models/Customers/CustomerAttributeModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Customers/CustomerAttributeModel.cs
@@ -4,7 +4,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Customers
{
- public partial class CustomerAttributeModel : BaseEntityModel, ILocalizedModel<CustomerAttributeLocalizedModel>
+ public class CustomerAttributeModel : BaseEntityModel, ILocalizedModel<CustomerAttributeLocalizedModel>
{
public CustomerAttributeModel()
{
@@ -34,7 +34,7 @@ namespace Grand.Web.Admin.Models.Customers
}
- public partial class CustomerAttributeLocalizedModel : ILocalizedModelLocal
+ public class CustomerAttributeLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Customers/CustomerAttributeValueModel.cs b/src/Web/Grand.Web.Admin/Models/Customers/CustomerAttributeValueModel.cs
index 9c19bf886..629dcb40a 100644
--- a/src/Web/Grand.Web.Admin/Models/Customers/CustomerAttributeValueModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Customers/CustomerAttributeValueModel.cs
@@ -4,7 +4,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Customers
{
- public partial class CustomerAttributeValueModel : BaseEntityModel, ILocalizedModel<CustomerAttributeValueLocalizedModel>
+ public class CustomerAttributeValueModel : BaseEntityModel, ILocalizedModel<CustomerAttributeValueLocalizedModel>
{
public CustomerAttributeValueModel()
{
@@ -27,7 +27,7 @@ namespace Grand.Web.Admin.Models.Customers
}
- public partial class CustomerAttributeValueLocalizedModel : ILocalizedModelLocal
+ public class CustomerAttributeValueLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Customers/CustomerGroupModel.cs b/src/Web/Grand.Web.Admin/Models/Customers/CustomerGroupModel.cs
index 465aaad16..51c5f2d07 100644
--- a/src/Web/Grand.Web.Admin/Models/Customers/CustomerGroupModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Customers/CustomerGroupModel.cs
@@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Customers
{
- public partial class CustomerGroupModel : BaseEntityModel
+ public class CustomerGroupModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Customers.CustomerGroups.Fields.Name")]
diff --git a/src/Web/Grand.Web.Admin/Models/Customers/CustomerGroupProductModel.cs b/src/Web/Grand.Web.Admin/Models/Customers/CustomerGroupProductModel.cs
index a81979c5f..437562ee9 100644
--- a/src/Web/Grand.Web.Admin/Models/Customers/CustomerGroupProductModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Customers/CustomerGroupProductModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Customers
{
- public partial class CustomerGroupProductModel: BaseEntityModel
+ public class CustomerGroupProductModel: BaseEntityModel
{
[GrandResourceDisplayName("Admin.Customers.CustomerGroups.Products.Fields.Name")]
@@ -18,7 +18,7 @@ namespace Grand.Web.Admin.Models.Customers
- public partial class AddProductModel : BaseModel
+ public class AddProductModel : BaseModel
{
public AddProductModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Customers/CustomerListModel.cs b/src/Web/Grand.Web.Admin/Models/Customers/CustomerListModel.cs
index 4eff84854..356004dd2 100644
--- a/src/Web/Grand.Web.Admin/Models/Customers/CustomerListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Customers/CustomerListModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Customers
{
- public partial class CustomerListModel : BaseModel
+ public class CustomerListModel : BaseModel
{
public CustomerListModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Customers/CustomerModel.cs b/src/Web/Grand.Web.Admin/Models/Customers/CustomerModel.cs
index 1e2f89353..4d2042a20 100644
--- a/src/Web/Grand.Web.Admin/Models/Customers/CustomerModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Customers/CustomerModel.cs
@@ -8,11 +8,11 @@ using Grand.Domain.Common;
namespace Grand.Web.Admin.Models.Customers
{
- public partial class CustomerModel : BaseEntityModel
+ public class CustomerModel : BaseEntityModel
{
public CustomerModel()
{
- SendEmail = new SendEmailModel() { SendImmediately = true };
+ SendEmail = new SendEmailModel { SendImmediately = true };
AssociatedExternalAuthRecords = new List<AssociatedExternalAuthModel>();
AvailableCountries = new List<SelectListItem>();
AvailableStates = new List<SelectListItem>();
@@ -230,7 +230,7 @@ namespace Grand.Web.Admin.Models.Customers
#region Nested classes
- public partial class AssociatedExternalAuthModel : BaseEntityModel
+ public class AssociatedExternalAuthModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Customers.Customers.AssociatedExternalAuth.Fields.Email")]
public string Email { get; set; }
@@ -242,7 +242,7 @@ namespace Grand.Web.Admin.Models.Customers
public string AuthMethodName { get; set; }
}
- public partial class LoyaltyPointsHistoryModel : BaseEntityModel
+ public class LoyaltyPointsHistoryModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Customers.Customers.LoyaltyPoints.Fields.Store")]
public string StoreName { get; set; }
@@ -260,7 +260,7 @@ namespace Grand.Web.Admin.Models.Customers
public DateTime CreatedOn { get; set; }
}
- public partial class SendEmailModel : BaseModel
+ public class SendEmailModel : BaseModel
{
[GrandResourceDisplayName("Admin.Customers.Customers.SendEmail.Subject")]
public string Subject { get; set; }
@@ -275,7 +275,7 @@ namespace Grand.Web.Admin.Models.Customers
public DateTime? DontSendBeforeDate { get; set; }
}
- public partial class OrderModel : BaseEntityModel
+ public class OrderModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Customers.Customers.Orders.ID")]
public override string Id { get; set; }
@@ -300,7 +300,7 @@ namespace Grand.Web.Admin.Models.Customers
public DateTime CreatedOn { get; set; }
}
- public partial class ActivityLogModel : BaseEntityModel
+ public class ActivityLogModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Customers.Customers.ActivityLog.ActivityLogType")]
public string ActivityLogTypeName { get; set; }
@@ -311,7 +311,7 @@ namespace Grand.Web.Admin.Models.Customers
[GrandResourceDisplayName("Admin.Customers.Customers.ActivityLog.IpAddress")]
public string IpAddress { get; set; }
}
- public partial class ProductModel : BaseEntityModel
+ public class ProductModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Customers.Customers.PersonalizedProduct.ProductName")]
public string ProductName { get; set; }
@@ -319,7 +319,7 @@ namespace Grand.Web.Admin.Models.Customers
public int DisplayOrder { get; set; }
public string ProductId { get; set; }
}
- public partial class ProductPriceModel : BaseEntityModel
+ public class ProductPriceModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Customers.Customers.ProductPrice.ProductName")]
public string ProductName { get; set; }
@@ -327,7 +327,7 @@ namespace Grand.Web.Admin.Models.Customers
public double Price { get; set; }
public string ProductId { get; set; }
}
- public partial class AddProductModel : BaseModel
+ public class AddProductModel : BaseModel
{
public AddProductModel()
{
@@ -363,7 +363,7 @@ namespace Grand.Web.Admin.Models.Customers
public string[] SelectedProductIds { get; set; }
}
- public partial class OutOfStockSubscriptionModel : BaseEntityModel
+ public class OutOfStockSubscriptionModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Customers.Customers.OutOfStockSubscriptions.Store")]
public string StoreName { get; set; }
@@ -376,7 +376,7 @@ namespace Grand.Web.Admin.Models.Customers
public DateTime CreatedOn { get; set; }
}
- public partial class CustomerAttributeModel : BaseEntityModel
+ public class CustomerAttributeModel : BaseEntityModel
{
public CustomerAttributeModel()
{
@@ -398,14 +398,14 @@ namespace Grand.Web.Admin.Models.Customers
}
- public partial class CustomerAttributeValueModel : BaseEntityModel
+ public class CustomerAttributeValueModel : BaseEntityModel
{
public string Name { get; set; }
public bool IsPreSelected { get; set; }
}
- public partial class CustomerNote : BaseEntityModel
+ public class CustomerNote : BaseEntityModel
{
public string CustomerId { get; set; }
[GrandResourceDisplayName("Admin.Customers.CustomerNotes.Fields.DisplayToCustomer")]
diff --git a/src/Web/Grand.Web.Admin/Models/Customers/CustomerReportsModel.cs b/src/Web/Grand.Web.Admin/Models/Customers/CustomerReportsModel.cs
index 5d60051b9..5b424f702 100644
--- a/src/Web/Grand.Web.Admin/Models/Customers/CustomerReportsModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Customers/CustomerReportsModel.cs
@@ -2,7 +2,7 @@
namespace Grand.Web.Admin.Models.Customers
{
- public partial class CustomerReportsModel : BaseModel
+ public class CustomerReportsModel : BaseModel
{
public BestCustomersReportModel BestCustomersByOrderTotal { get; set; }
public BestCustomersReportModel BestCustomersByNumberOfOrders { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Customers/CustomerReviewModel.cs b/src/Web/Grand.Web.Admin/Models/Customers/CustomerReviewModel.cs
index 855c37834..89771755f 100644
--- a/src/Web/Grand.Web.Admin/Models/Customers/CustomerReviewModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Customers/CustomerReviewModel.cs
@@ -2,7 +2,7 @@
namespace Grand.Web.Admin.Models.Customers
{
- public partial class CustomerReviewModel
+ public class CustomerReviewModel
{
public string CustomerId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Customers/CustomerTagModel.cs b/src/Web/Grand.Web.Admin/Models/Customers/CustomerTagModel.cs
index b2f42ad6b..14667b884 100644
--- a/src/Web/Grand.Web.Admin/Models/Customers/CustomerTagModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Customers/CustomerTagModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Customers
{
- public partial class CustomerTagModel : BaseEntityModel
+ public class CustomerTagModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Customers.CustomerTags.Fields.Name")]
diff --git a/src/Web/Grand.Web.Admin/Models/Customers/CustomerTagProductModel.cs b/src/Web/Grand.Web.Admin/Models/Customers/CustomerTagProductModel.cs
index 72a6c15c1..56e909916 100644
--- a/src/Web/Grand.Web.Admin/Models/Customers/CustomerTagProductModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Customers/CustomerTagProductModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Customers
{
- public partial class CustomerTagProductModel: BaseEntityModel
+ public class CustomerTagProductModel: BaseEntityModel
{
[GrandResourceDisplayName("Admin.Customers.CustomerTags.Products.Fields.Name")]
@@ -16,7 +16,7 @@ namespace Grand.Web.Admin.Models.Customers
- public partial class AddProductModel : BaseModel
+ public class AddProductModel : BaseModel
{
public AddProductModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Customers/OnlineCustomerModel.cs b/src/Web/Grand.Web.Admin/Models/Customers/OnlineCustomerModel.cs
index 514aef423..2995be48e 100644
--- a/src/Web/Grand.Web.Admin/Models/Customers/OnlineCustomerModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Customers/OnlineCustomerModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Customers
{
- public partial class OnlineCustomerModel : BaseEntityModel
+ public class OnlineCustomerModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Dashboards.OnlineCustomers.Fields.CustomerInfo")]
public string CustomerInfo { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Customers/RegisteredCustomerReportLineModel.cs b/src/Web/Grand.Web.Admin/Models/Customers/RegisteredCustomerReportLineModel.cs
index 3b9af5872..5304cde95 100644
--- a/src/Web/Grand.Web.Admin/Models/Customers/RegisteredCustomerReportLineModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Customers/RegisteredCustomerReportLineModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Customers
{
- public partial class RegisteredCustomerReportLineModel : BaseModel
+ public class RegisteredCustomerReportLineModel : BaseModel
{
[GrandResourceDisplayName("Admin.Reports.Customers.RegisteredCustomers.Fields.Period")]
public string Period { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Customers/SalesEmployeeModel.cs b/src/Web/Grand.Web.Admin/Models/Customers/SalesEmployeeModel.cs
index bd92f0c4e..5ac929ffa 100644
--- a/src/Web/Grand.Web.Admin/Models/Customers/SalesEmployeeModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Customers/SalesEmployeeModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Customers
{
- public partial class SalesEmployeeModel : BaseEntityModel
+ public class SalesEmployeeModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Customers.SalesEmployee.Fields.Name")]
public string Name { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Customers/UserApiModel.cs b/src/Web/Grand.Web.Admin/Models/Customers/UserApiModel.cs
index fa1483c16..835648151 100644
--- a/src/Web/Grand.Web.Admin/Models/Customers/UserApiModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Customers/UserApiModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Customers
{
- public partial class UserApiModel : BaseEntityModel
+ public class UserApiModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.System.UserApi.Email")]
public string Email { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Directory/CountryModel.cs b/src/Web/Grand.Web.Admin/Models/Directory/CountryModel.cs
index 9dffe9453..7d63a678d 100644
--- a/src/Web/Grand.Web.Admin/Models/Directory/CountryModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Directory/CountryModel.cs
@@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Directory
{
- public partial class CountryModel : BaseEntityModel, ILocalizedModel<CountryLocalizedModel>, IStoreLinkModel
+ public class CountryModel : BaseEntityModel, ILocalizedModel<CountryLocalizedModel>, IStoreLinkModel
{
public CountryModel()
{
@@ -54,7 +54,7 @@ namespace Grand.Web.Admin.Models.Directory
public string[] Stores { get; set; }
}
- public partial class CountryLocalizedModel : ILocalizedModelLocal
+ public class CountryLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Directory/CurrencyModel.cs b/src/Web/Grand.Web.Admin/Models/Directory/CurrencyModel.cs
index 3d15eaf8d..f54bb77b2 100644
--- a/src/Web/Grand.Web.Admin/Models/Directory/CurrencyModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Directory/CurrencyModel.cs
@@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Directory
{
- public partial class CurrencyModel : BaseEntityModel, ILocalizedModel<CurrencyLocalizedModel>, IStoreLinkModel
+ public class CurrencyModel : BaseEntityModel, ILocalizedModel<CurrencyLocalizedModel>, IStoreLinkModel
{
public CurrencyModel()
{
@@ -64,7 +64,7 @@ namespace Grand.Web.Admin.Models.Directory
}
- public partial class CurrencyLocalizedModel : ILocalizedModelLocal
+ public class CurrencyLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Directory/MeasureDimensionModel.cs b/src/Web/Grand.Web.Admin/Models/Directory/MeasureDimensionModel.cs
index 387c03c95..5fa7093bd 100644
--- a/src/Web/Grand.Web.Admin/Models/Directory/MeasureDimensionModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Directory/MeasureDimensionModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Directory
{
- public partial class MeasureDimensionModel : BaseEntityModel
+ public class MeasureDimensionModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Configuration.Measures.Dimensions.Fields.Name")]
diff --git a/src/Web/Grand.Web.Admin/Models/Directory/MeasureUnitModel.cs b/src/Web/Grand.Web.Admin/Models/Directory/MeasureUnitModel.cs
index ebcd4c4ad..25141c866 100644
--- a/src/Web/Grand.Web.Admin/Models/Directory/MeasureUnitModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Directory/MeasureUnitModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Directory
{
- public partial class MeasureUnitModel : BaseEntityModel
+ public class MeasureUnitModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Configuration.Measures.Units.Fields.Name")]
diff --git a/src/Web/Grand.Web.Admin/Models/Directory/MeasureWeightModel.cs b/src/Web/Grand.Web.Admin/Models/Directory/MeasureWeightModel.cs
index ffbc8b8a5..6c775bf02 100644
--- a/src/Web/Grand.Web.Admin/Models/Directory/MeasureWeightModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Directory/MeasureWeightModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Directory
{
- public partial class MeasureWeightModel : BaseEntityModel
+ public class MeasureWeightModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Configuration.Measures.Weights.Fields.Name")]
public string Name { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Directory/RobotsTxtModel.cs b/src/Web/Grand.Web.Admin/Models/Directory/RobotsTxtModel.cs
index 12153e87b..3ac8e31a3 100644
--- a/src/Web/Grand.Web.Admin/Models/Directory/RobotsTxtModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Directory/RobotsTxtModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Directory
{
- public partial class RobotsTxtModel : BaseEntityModel
+ public class RobotsTxtModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Configuration.RobotsTxt.Fields.Name")]
public string Name { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Directory/StateProvinceModel.cs b/src/Web/Grand.Web.Admin/Models/Directory/StateProvinceModel.cs
index 890b68258..07ef382fe 100644
--- a/src/Web/Grand.Web.Admin/Models/Directory/StateProvinceModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Directory/StateProvinceModel.cs
@@ -4,7 +4,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Directory
{
- public partial class StateProvinceModel : BaseEntityModel, ILocalizedModel<StateProvinceLocalizedModel>
+ public class StateProvinceModel : BaseEntityModel, ILocalizedModel<StateProvinceLocalizedModel>
{
public StateProvinceModel()
{
@@ -29,7 +29,7 @@ namespace Grand.Web.Admin.Models.Directory
public IList<StateProvinceLocalizedModel> Locales { get; set; }
}
- public partial class StateProvinceLocalizedModel : ILocalizedModelLocal
+ public class StateProvinceLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Discounts/DiscountListModel.cs b/src/Web/Grand.Web.Admin/Models/Discounts/DiscountListModel.cs
index 80f1b78ef..d2c3e0d0c 100644
--- a/src/Web/Grand.Web.Admin/Models/Discounts/DiscountListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Discounts/DiscountListModel.cs
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Models.Discounts
{
- public partial class DiscountListModel : BaseModel
+ public class DiscountListModel : BaseModel
{
public DiscountListModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Discounts/DiscountModel.cs b/src/Web/Grand.Web.Admin/Models/Discounts/DiscountModel.cs
index bcbb9c42e..f78a9cd76 100644
--- a/src/Web/Grand.Web.Admin/Models/Discounts/DiscountModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Discounts/DiscountModel.cs
@@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Discounts
{
- public partial class DiscountModel : BaseEntityModel, IStoreLinkModel
+ public class DiscountModel : BaseEntityModel, IStoreLinkModel
{
public DiscountModel()
{
@@ -94,14 +94,14 @@ namespace Grand.Web.Admin.Models.Discounts
#region Nested classes
- public partial class DiscountRequirementMetaInfo : BaseModel
+ public class DiscountRequirementMetaInfo : BaseModel
{
public string DiscountRequirementId { get; set; }
public string RuleName { get; set; }
public string ConfigurationUrl { get; set; }
}
- public partial class DiscountUsageHistoryModel : BaseEntityModel
+ public class DiscountUsageHistoryModel : BaseEntityModel
{
public string DiscountId { get; set; }
@@ -117,13 +117,13 @@ namespace Grand.Web.Admin.Models.Discounts
public DateTime CreatedOn { get; set; }
}
- public partial class AppliedToCategoryModel : BaseModel
+ public class AppliedToCategoryModel : BaseModel
{
public string CategoryId { get; set; }
public string CategoryName { get; set; }
}
- public partial class AddCategoryToDiscountModel : BaseModel
+ public class AddCategoryToDiscountModel : BaseModel
{
[GrandResourceDisplayName("Admin.Catalog.Categories.List.SearchCategoryName")]
@@ -135,13 +135,13 @@ namespace Grand.Web.Admin.Models.Discounts
}
- public partial class AppliedToCollectionModel : BaseModel
+ public class AppliedToCollectionModel : BaseModel
{
public string CollectionId { get; set; }
public string CollectionName { get; set; }
}
- public partial class AddCollectionToDiscountModel : BaseModel
+ public class AddCollectionToDiscountModel : BaseModel
{
[GrandResourceDisplayName("Admin.Catalog.Collections.List.SearchCollectionName")]
@@ -153,13 +153,13 @@ namespace Grand.Web.Admin.Models.Discounts
}
- public partial class AppliedToProductModel : BaseModel
+ public class AppliedToProductModel : BaseModel
{
public string ProductId { get; set; }
public string ProductName { get; set; }
}
- public partial class AddProductToDiscountModel : BaseModel
+ public class AddProductToDiscountModel : BaseModel
{
public AddProductToDiscountModel()
{
@@ -196,13 +196,13 @@ namespace Grand.Web.Admin.Models.Discounts
public string[] SelectedProductIds { get; set; }
}
- public partial class AppliedToBrandModel : BaseModel
+ public class AppliedToBrandModel : BaseModel
{
public string BrandId { get; set; }
public string BrandName { get; set; }
}
- public partial class AddBrandToDiscountModel : BaseModel
+ public class AddBrandToDiscountModel : BaseModel
{
[GrandResourceDisplayName("Admin.Catalog.Brands.List.SearchBrandName")]
@@ -216,13 +216,13 @@ namespace Grand.Web.Admin.Models.Discounts
}
- public partial class AppliedToVendorModel : BaseModel
+ public class AppliedToVendorModel : BaseModel
{
public string VendorId { get; set; }
public string VendorName { get; set; }
}
- public partial class AddVendorToDiscountModel : BaseModel
+ public class AddVendorToDiscountModel : BaseModel
{
[GrandResourceDisplayName("Admin.Catalog.Vendors.List.SearchVendorName")]
@@ -238,13 +238,13 @@ namespace Grand.Web.Admin.Models.Discounts
}
- public partial class AppliedToStoreModel : BaseModel
+ public class AppliedToStoreModel : BaseModel
{
public string StoreId { get; set; }
public string StoreName { get; set; }
}
- public partial class AddStoreToDiscountModel : BaseModel
+ public class AddStoreToDiscountModel : BaseModel
{
[GrandResourceDisplayName("Admin.Catalog.Stores.List.SearchStoreName")]
diff --git a/src/Web/Grand.Web.Admin/Models/Documents/DocumentTypeModel.cs b/src/Web/Grand.Web.Admin/Models/Documents/DocumentTypeModel.cs
index 03be271f7..669e995c9 100644
--- a/src/Web/Grand.Web.Admin/Models/Documents/DocumentTypeModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Documents/DocumentTypeModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Documents
{
- public partial class DocumentTypeModel : BaseEntityModel
+ public class DocumentTypeModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Documents.Type.Fields.Name")]
diff --git a/src/Web/Grand.Web.Admin/Models/ExternalAuthentication/AuthenticationMethodModel.cs b/src/Web/Grand.Web.Admin/Models/ExternalAuthentication/AuthenticationMethodModel.cs
index baf9d8145..58e03a55f 100644
--- a/src/Web/Grand.Web.Admin/Models/ExternalAuthentication/AuthenticationMethodModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/ExternalAuthentication/AuthenticationMethodModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.ExternalAuthentication
{
- public partial class AuthenticationMethodModel : BaseModel
+ public class AuthenticationMethodModel : BaseModel
{
[GrandResourceDisplayName("Admin.Plugins.ExternalAuthenticationMethods.Fields.FriendlyName")]
public string FriendlyName { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Home/DashboardModel.cs b/src/Web/Grand.Web.Admin/Models/Home/DashboardModel.cs
index c48ab7bc8..c620b2b3e 100644
--- a/src/Web/Grand.Web.Admin/Models/Home/DashboardModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Home/DashboardModel.cs
@@ -2,13 +2,11 @@
namespace Grand.Web.Admin.Models.Home
{
- public partial class DashboardModel : BaseModel
+ public class DashboardModel : BaseModel
{
public bool IsLoggedInAsVendor { get; set; }
- public bool HideReportGA { get; set; }
-
}
- public partial class DashboardActivityModel : BaseModel
+ public class DashboardActivityModel : BaseModel
{
public int OrdersPending { get; set; }
public int AbandonedCarts { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Knowledgebase/KnowledgebaseArticleModel.cs b/src/Web/Grand.Web.Admin/Models/Knowledgebase/KnowledgebaseArticleModel.cs
index 9b4bd4f81..3cd36bc46 100644
--- a/src/Web/Grand.Web.Admin/Models/Knowledgebase/KnowledgebaseArticleModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Knowledgebase/KnowledgebaseArticleModel.cs
@@ -61,7 +61,7 @@ namespace Grand.Web.Admin.Models.Knowledgebase
[UIHint("Stores")]
public string[] Stores { get; set; }
- public partial class ActivityLogModel : BaseEntityModel
+ public class ActivityLogModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Content.Knowledgebase.ActivityLogType")]
public string ActivityLogTypeName { get; set; }
@@ -74,7 +74,7 @@ namespace Grand.Web.Admin.Models.Knowledgebase
public string CustomerEmail { get; set; }
}
- public partial class AddRelatedArticleModel : BaseEntityModel
+ public class AddRelatedArticleModel : BaseEntityModel
{
public AddRelatedArticleModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Knowledgebase/KnowledgebaseCategoryModel.cs b/src/Web/Grand.Web.Admin/Models/Knowledgebase/KnowledgebaseCategoryModel.cs
index 51b788bea..6f1c507de 100644
--- a/src/Web/Grand.Web.Admin/Models/Knowledgebase/KnowledgebaseCategoryModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Knowledgebase/KnowledgebaseCategoryModel.cs
@@ -56,7 +56,7 @@ namespace Grand.Web.Admin.Models.Knowledgebase
public string[] Stores { get; set; }
public bool LimitedToStores { get; set; }
- public partial class ActivityLogModel : BaseEntityModel
+ public class ActivityLogModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Content.Knowledgebase.ActivityLogType")]
public string ActivityLogTypeName { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Layouts/BrandLayoutModel.cs b/src/Web/Grand.Web.Admin/Models/Layouts/BrandLayoutModel.cs
index 72cce6ca7..c48829d1a 100644
--- a/src/Web/Grand.Web.Admin/Models/Layouts/BrandLayoutModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Layouts/BrandLayoutModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Layouts
{
- public partial class BrandLayoutModel : BaseEntityModel
+ public class BrandLayoutModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Configuration.Layouts.Brand.Name")]
diff --git a/src/Web/Grand.Web.Admin/Models/Layouts/CategoryLayoutModel.cs b/src/Web/Grand.Web.Admin/Models/Layouts/CategoryLayoutModel.cs
index e6c7e8f37..16e163fb6 100644
--- a/src/Web/Grand.Web.Admin/Models/Layouts/CategoryLayoutModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Layouts/CategoryLayoutModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Layouts
{
- public partial class CategoryLayoutModel : BaseEntityModel
+ public class CategoryLayoutModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Configuration.Layouts.Category.Name")]
diff --git a/src/Web/Grand.Web.Admin/Models/Layouts/CollectionLayoutModel.cs b/src/Web/Grand.Web.Admin/Models/Layouts/CollectionLayoutModel.cs
index 571a6686c..f9a41134d 100644
--- a/src/Web/Grand.Web.Admin/Models/Layouts/CollectionLayoutModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Layouts/CollectionLayoutModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Layouts
{
- public partial class CollectionLayoutModel : BaseEntityModel
+ public class CollectionLayoutModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Configuration.Layouts.Collection.Name")]
diff --git a/src/Web/Grand.Web.Admin/Models/Layouts/PageLayoutModel.cs b/src/Web/Grand.Web.Admin/Models/Layouts/PageLayoutModel.cs
index fe1a98581..13e70e54e 100644
--- a/src/Web/Grand.Web.Admin/Models/Layouts/PageLayoutModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Layouts/PageLayoutModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Layouts
{
- public partial class PageLayoutModel : BaseEntityModel
+ public class PageLayoutModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Configuration.Layouts.Page.Name")]
diff --git a/src/Web/Grand.Web.Admin/Models/Layouts/ProductLayoutModel.cs b/src/Web/Grand.Web.Admin/Models/Layouts/ProductLayoutModel.cs
index 33f20959b..d20e1772f 100644
--- a/src/Web/Grand.Web.Admin/Models/Layouts/ProductLayoutModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Layouts/ProductLayoutModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Layouts
{
- public partial class ProductLayoutModel : BaseEntityModel
+ public class ProductLayoutModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Configuration.Layouts.Product.Name")]
diff --git a/src/Web/Grand.Web.Admin/Models/Localization/LanguageModel.cs b/src/Web/Grand.Web.Admin/Models/Localization/LanguageModel.cs
index 9b54f08d4..32d38742f 100644
--- a/src/Web/Grand.Web.Admin/Models/Localization/LanguageModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Localization/LanguageModel.cs
@@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Localization
{
- public partial class LanguageModel : BaseEntityModel, IStoreLinkModel
+ public class LanguageModel : BaseEntityModel, IStoreLinkModel
{
public LanguageModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Localization/LanguageResourceFilterModel.cs b/src/Web/Grand.Web.Admin/Models/Localization/LanguageResourceFilterModel.cs
index 7ecfc0b19..c8922925e 100644
--- a/src/Web/Grand.Web.Admin/Models/Localization/LanguageResourceFilterModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Localization/LanguageResourceFilterModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Localization
{
- public partial class LanguageResourceFilterModel : BaseEntityModel
+ public class LanguageResourceFilterModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Configuration.Languages.ResourcesFilter.Fields.ResourceName")]
public string ResourceName { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Localization/LanguageResourceModel.cs b/src/Web/Grand.Web.Admin/Models/Localization/LanguageResourceModel.cs
index b56d55335..2f74cd8f0 100644
--- a/src/Web/Grand.Web.Admin/Models/Localization/LanguageResourceModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Localization/LanguageResourceModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Localization
{
- public partial class LanguageResourceModel : BaseEntityModel
+ public class LanguageResourceModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Configuration.Languages.Resources.Fields.Name")]
public string Name { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Logging/ActivityLogModel.cs b/src/Web/Grand.Web.Admin/Models/Logging/ActivityLogModel.cs
index 3d983b542..4a75f24b5 100644
--- a/src/Web/Grand.Web.Admin/Models/Logging/ActivityLogModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Logging/ActivityLogModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Logging
{
- public partial class ActivityLogModel : BaseEntityModel
+ public class ActivityLogModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Configuration.ActivityLog.ActivityLog.Fields.ActivityLogType")]
public string ActivityLogTypeName { get; set; }
@@ -21,7 +21,7 @@ namespace Grand.Web.Admin.Models.Logging
public DateTime CreatedOn { get; set; }
}
- public partial class ActivityStatsModel : BaseEntityModel
+ public class ActivityStatsModel : BaseEntityModel
{
[GrandResourceDisplayName("admin.reports.activitylog.activitystats.Fields.ActivityLogType")]
public string ActivityLogTypeName { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Logging/ActivityLogSearchModel.cs b/src/Web/Grand.Web.Admin/Models/Logging/ActivityLogSearchModel.cs
index 56dda6dad..3783e837c 100644
--- a/src/Web/Grand.Web.Admin/Models/Logging/ActivityLogSearchModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Logging/ActivityLogSearchModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Logging
{
- public partial class ActivityLogSearchModel : BaseModel
+ public class ActivityLogSearchModel : BaseModel
{
public ActivityLogSearchModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Logging/ActivityLogTypeModel.cs b/src/Web/Grand.Web.Admin/Models/Logging/ActivityLogTypeModel.cs
index 874707f48..84704e504 100644
--- a/src/Web/Grand.Web.Admin/Models/Logging/ActivityLogTypeModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Logging/ActivityLogTypeModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Logging
{
- public partial class ActivityLogTypeModel : BaseEntityModel
+ public class ActivityLogTypeModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Settings.ActivityLog.ActivityLogType.Fields.Name")]
public string Name { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Logging/LogListModel.cs b/src/Web/Grand.Web.Admin/Models/Logging/LogListModel.cs
index 93fcf6558..29f1e24b2 100644
--- a/src/Web/Grand.Web.Admin/Models/Logging/LogListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Logging/LogListModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Logging
{
- public partial class LogListModel : BaseModel
+ public class LogListModel : BaseModel
{
public LogListModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Logging/LogModel.cs b/src/Web/Grand.Web.Admin/Models/Logging/LogModel.cs
index 28e259ff0..b254ebb52 100644
--- a/src/Web/Grand.Web.Admin/Models/Logging/LogModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Logging/LogModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Logging
{
- public partial class LogModel : BaseEntityModel
+ public class LogModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.System.Log.Fields.LogLevel")]
public string LogLevel { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Messages/CampaignModel.cs b/src/Web/Grand.Web.Admin/Models/Messages/CampaignModel.cs
index 4c4c0e192..62ffd2adf 100644
--- a/src/Web/Grand.Web.Admin/Models/Messages/CampaignModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Messages/CampaignModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Messages
{
- public partial class CampaignModel : BaseEntityModel
+ public class CampaignModel : BaseEntityModel
{
public CampaignModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Messages/ContactAttributeModel.cs b/src/Web/Grand.Web.Admin/Models/Messages/ContactAttributeModel.cs
index c8e1c84a2..b3ac0f2d6 100644
--- a/src/Web/Grand.Web.Admin/Models/Messages/ContactAttributeModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Messages/ContactAttributeModel.cs
@@ -8,7 +8,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Messages
{
- public partial class ContactAttributeModel : BaseEntityModel, ILocalizedModel<ContactAttributeLocalizedModel>, IGroupLinkModel, IStoreLinkModel
+ public class ContactAttributeModel : BaseEntityModel, ILocalizedModel<ContactAttributeLocalizedModel>, IGroupLinkModel, IStoreLinkModel
{
public ContactAttributeModel()
{
@@ -71,7 +71,7 @@ namespace Grand.Web.Admin.Models.Messages
public string[] CustomerGroups { get; set; }
}
- public partial class ConditionModel : BaseEntityModel
+ public class ConditionModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Catalog.Attributes.ContactAttributes.Condition.EnableCondition")]
public bool EnableCondition { get; set; }
@@ -81,7 +81,7 @@ namespace Grand.Web.Admin.Models.Messages
public IList<AttributeConditionModel> ConditionAttributes { get; set; }
}
- public partial class AttributeConditionModel : BaseEntityModel
+ public class AttributeConditionModel : BaseEntityModel
{
public string Name { get; set; }
@@ -91,7 +91,7 @@ namespace Grand.Web.Admin.Models.Messages
public string SelectedValueId { get; set; }
}
- public partial class ContactAttributeLocalizedModel : ILocalizedModelLocal
+ public class ContactAttributeLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Messages/ContactAttributeValueModel.cs b/src/Web/Grand.Web.Admin/Models/Messages/ContactAttributeValueModel.cs
index 9e251e353..354c8ed33 100644
--- a/src/Web/Grand.Web.Admin/Models/Messages/ContactAttributeValueModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Messages/ContactAttributeValueModel.cs
@@ -4,7 +4,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Messages
{
- public partial class ContactAttributeValueModel : BaseEntityModel, ILocalizedModel<ContactAttributeValueLocalizedModel>
+ public class ContactAttributeValueModel : BaseEntityModel, ILocalizedModel<ContactAttributeValueLocalizedModel>
{
public ContactAttributeValueModel()
{
@@ -30,7 +30,7 @@ namespace Grand.Web.Admin.Models.Messages
}
- public partial class ContactAttributeValueLocalizedModel : ILocalizedModelLocal
+ public class ContactAttributeValueLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Messages/ContactFormListModel.cs b/src/Web/Grand.Web.Admin/Models/Messages/ContactFormListModel.cs
index 7f23f18d6..0f8a692bb 100644
--- a/src/Web/Grand.Web.Admin/Models/Messages/ContactFormListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Messages/ContactFormListModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Messages
{
- public partial class ContactFormListModel : BaseModel
+ public class ContactFormListModel : BaseModel
{
public ContactFormListModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Messages/ContactFormModel.cs b/src/Web/Grand.Web.Admin/Models/Messages/ContactFormModel.cs
index 945a9c3b3..aa5b777bc 100644
--- a/src/Web/Grand.Web.Admin/Models/Messages/ContactFormModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Messages/ContactFormModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Messages
{
- public partial class ContactFormModel: BaseEntityModel
+ public class ContactFormModel: BaseEntityModel
{
public override string Id { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Messages/EmailAccountModel.cs b/src/Web/Grand.Web.Admin/Models/Messages/EmailAccountModel.cs
index 86c59b2d7..f8bf74204 100644
--- a/src/Web/Grand.Web.Admin/Models/Messages/EmailAccountModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Messages/EmailAccountModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Messages
{
- public partial class EmailAccountModel : BaseEntityModel
+ public class EmailAccountModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Configuration.EmailAccounts.Fields.Email")]
public string Email { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Messages/MessageTemplateListModel.cs b/src/Web/Grand.Web.Admin/Models/Messages/MessageTemplateListModel.cs
index b1953f0ba..3f368cf93 100644
--- a/src/Web/Grand.Web.Admin/Models/Messages/MessageTemplateListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Messages/MessageTemplateListModel.cs
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Models.Messages
{
- public partial class MessageTemplateListModel : BaseModel
+ public class MessageTemplateListModel : BaseModel
{
public MessageTemplateListModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Messages/MessageTemplateModel.cs b/src/Web/Grand.Web.Admin/Models/Messages/MessageTemplateModel.cs
index bef8f4e4a..bc67b4581 100644
--- a/src/Web/Grand.Web.Admin/Models/Messages/MessageTemplateModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Messages/MessageTemplateModel.cs
@@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Messages
{
- public partial class MessageTemplateModel : BaseEntityModel, ILocalizedModel<MessageTemplateLocalizedModel>, IStoreLinkModel
+ public class MessageTemplateModel : BaseEntityModel, ILocalizedModel<MessageTemplateLocalizedModel>, IStoreLinkModel
{
public MessageTemplateModel()
{
@@ -67,7 +67,7 @@ namespace Grand.Web.Admin.Models.Messages
public IList<MessageTemplateLocalizedModel> Locales { get; set; }
}
- public partial class MessageTemplateLocalizedModel : ILocalizedModelLocal
+ public class MessageTemplateLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Messages/NewsLetterSubscriptionListModel.cs b/src/Web/Grand.Web.Admin/Models/Messages/NewsLetterSubscriptionListModel.cs
index cf337b480..fa019be95 100644
--- a/src/Web/Grand.Web.Admin/Models/Messages/NewsLetterSubscriptionListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Messages/NewsLetterSubscriptionListModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Messages
{
- public partial class NewsLetterSubscriptionListModel : BaseModel
+ public class NewsLetterSubscriptionListModel : BaseModel
{
public NewsLetterSubscriptionListModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Messages/NewsLetterSubscriptionModel.cs b/src/Web/Grand.Web.Admin/Models/Messages/NewsLetterSubscriptionModel.cs
index ee13f9982..e25c7a5c7 100644
--- a/src/Web/Grand.Web.Admin/Models/Messages/NewsLetterSubscriptionModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Messages/NewsLetterSubscriptionModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Messages
{
- public partial class NewsLetterSubscriptionModel : BaseEntityModel
+ public class NewsLetterSubscriptionModel : BaseEntityModel
{
[GrandResourceDisplayName("admin.marketing.NewsLetterSubscriptions.Fields.Email")]
public string Email { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Messages/NewsletterCategoryModel.cs b/src/Web/Grand.Web.Admin/Models/Messages/NewsletterCategoryModel.cs
index dc8479320..6d75e4c88 100644
--- a/src/Web/Grand.Web.Admin/Models/Messages/NewsletterCategoryModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Messages/NewsletterCategoryModel.cs
@@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Messages
{
- public partial class NewsletterCategoryModel : BaseEntityModel, ILocalizedModel<NewsletterCategoryLocalizedModel>, IStoreLinkModel
+ public class NewsletterCategoryModel : BaseEntityModel, ILocalizedModel<NewsletterCategoryLocalizedModel>, IStoreLinkModel
{
public NewsletterCategoryModel()
{
@@ -33,7 +33,7 @@ namespace Grand.Web.Admin.Models.Messages
public IList<NewsletterCategoryLocalizedModel> Locales { get; set; }
}
- public partial class NewsletterCategoryLocalizedModel : ILocalizedModelLocal
+ public class NewsletterCategoryLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Messages/QueuedEmailListModel.cs b/src/Web/Grand.Web.Admin/Models/Messages/QueuedEmailListModel.cs
index ea67c6e7c..dfe977b10 100644
--- a/src/Web/Grand.Web.Admin/Models/Messages/QueuedEmailListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Messages/QueuedEmailListModel.cs
@@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Messages
{
- public partial class QueuedEmailListModel : BaseModel
+ public class QueuedEmailListModel : BaseModel
{
[GrandResourceDisplayName("Admin.System.QueuedEmails.List.StartDate")]
[UIHint("DateNullable")]
diff --git a/src/Web/Grand.Web.Admin/Models/Messages/QueuedEmailModel.cs b/src/Web/Grand.Web.Admin/Models/Messages/QueuedEmailModel.cs
index 6fae4f36a..671afe494 100644
--- a/src/Web/Grand.Web.Admin/Models/Messages/QueuedEmailModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Messages/QueuedEmailModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Messages
{
- public partial class QueuedEmailModel : BaseEntityModel
+ public class QueuedEmailModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.System.QueuedEmails.Fields.Id")]
public override string Id { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/News/NewsCommentModel.cs b/src/Web/Grand.Web.Admin/Models/News/NewsCommentModel.cs
index 5740b0a2a..53cc7bed5 100644
--- a/src/Web/Grand.Web.Admin/Models/News/NewsCommentModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/News/NewsCommentModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.News
{
- public partial class NewsCommentModel : BaseEntityModel
+ public class NewsCommentModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Content.News.Comments.Fields.NewsItem")]
public string NewsItemId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/News/NewsItemListModel.cs b/src/Web/Grand.Web.Admin/Models/News/NewsItemListModel.cs
index 04e23924b..fbbc78371 100644
--- a/src/Web/Grand.Web.Admin/Models/News/NewsItemListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/News/NewsItemListModel.cs
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Models.News
{
- public partial class NewsItemListModel : BaseModel
+ public class NewsItemListModel : BaseModel
{
public NewsItemListModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/News/NewsItemModel.cs b/src/Web/Grand.Web.Admin/Models/News/NewsItemModel.cs
index 645c997c4..9dddabfab 100644
--- a/src/Web/Grand.Web.Admin/Models/News/NewsItemModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/News/NewsItemModel.cs
@@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.News
{
- public partial class NewsItemModel : BaseEntityModel, ILocalizedModel<NewsLocalizedModel>, IGroupLinkModel, IStoreLinkModel
+ public class NewsItemModel : BaseEntityModel, ILocalizedModel<NewsLocalizedModel>, IGroupLinkModel, IStoreLinkModel
{
public NewsItemModel()
{
@@ -72,7 +72,7 @@ namespace Grand.Web.Admin.Models.News
}
- public partial class NewsLocalizedModel : ILocalizedModelLocal, ISlugModelLocal
+ public class NewsLocalizedModel : ILocalizedModelLocal, ISlugModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/BestsellersReportLineModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/BestsellersReportLineModel.cs
index 10b37e918..cd1ad555a 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/BestsellersReportLineModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/BestsellersReportLineModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Orders
{
- public partial class BestsellersReportLineModel : BaseModel
+ public class BestsellersReportLineModel : BaseModel
{
public string ProductId { get; set; }
[GrandResourceDisplayName("Admin.Reports.Bestsellers.Fields.Name")]
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/BestsellersReportModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/BestsellersReportModel.cs
index b12c2ccc2..3adde294f 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/BestsellersReportModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/BestsellersReportModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Orders
{
- public partial class BestsellersReportModel : BaseModel
+ public class BestsellersReportModel : BaseModel
{
public BestsellersReportModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/CheckoutAttributeModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/CheckoutAttributeModel.cs
index 0ec2e461f..f23f925ed 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/CheckoutAttributeModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/CheckoutAttributeModel.cs
@@ -8,7 +8,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Orders
{
- public partial class CheckoutAttributeModel : BaseEntityModel, ILocalizedModel<CheckoutAttributeLocalizedModel>, IGroupLinkModel, IStoreLinkModel
+ public class CheckoutAttributeModel : BaseEntityModel, ILocalizedModel<CheckoutAttributeLocalizedModel>, IGroupLinkModel, IStoreLinkModel
{
public CheckoutAttributeModel()
{
@@ -81,7 +81,7 @@ namespace Grand.Web.Admin.Models.Orders
public string[] CustomerGroups { get; set; }
}
- public partial class ConditionModel : BaseEntityModel
+ public class ConditionModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Orders.CheckoutAttributes.Condition.EnableCondition")]
public bool EnableCondition { get; set; }
@@ -91,7 +91,7 @@ namespace Grand.Web.Admin.Models.Orders
public IList<AttributeConditionModel> ConditionAttributes { get; set; }
}
- public partial class AttributeConditionModel : BaseEntityModel
+ public class AttributeConditionModel : BaseEntityModel
{
public string Name { get; set; }
@@ -101,7 +101,7 @@ namespace Grand.Web.Admin.Models.Orders
public string SelectedValueId { get; set; }
}
- public partial class CheckoutAttributeLocalizedModel : ILocalizedModelLocal
+ public class CheckoutAttributeLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/CheckoutAttributeValueModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/CheckoutAttributeValueModel.cs
index 233823d1d..d71a32a53 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/CheckoutAttributeValueModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/CheckoutAttributeValueModel.cs
@@ -4,7 +4,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Orders
{
- public partial class CheckoutAttributeValueModel : BaseEntityModel, ILocalizedModel<CheckoutAttributeValueLocalizedModel>
+ public class CheckoutAttributeValueModel : BaseEntityModel, ILocalizedModel<CheckoutAttributeValueLocalizedModel>
{
public CheckoutAttributeValueModel()
{
@@ -40,7 +40,7 @@ namespace Grand.Web.Admin.Models.Orders
}
- public partial class CheckoutAttributeValueLocalizedModel : ILocalizedModelLocal
+ public class CheckoutAttributeValueLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/CountryReportLineModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/CountryReportLineModel.cs
index 1e4ae12f6..8b4598763 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/CountryReportLineModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/CountryReportLineModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Orders
{
- public partial class CountryReportLineModel : BaseModel
+ public class CountryReportLineModel : BaseModel
{
[GrandResourceDisplayName("Admin.Reports.Country.Fields.CountryName")]
public string CountryName { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/CountryReportModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/CountryReportModel.cs
index 6846bbef7..c20ab11a2 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/CountryReportModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/CountryReportModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Orders
{
- public partial class CountryReportModel : BaseModel
+ public class CountryReportModel : BaseModel
{
public CountryReportModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/GiftVoucherListModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/GiftVoucherListModel.cs
index 2e185c952..ffbbd1088 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/GiftVoucherListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/GiftVoucherListModel.cs
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Models.Orders
{
- public partial class GiftVoucherListModel : BaseModel
+ public class GiftVoucherListModel : BaseModel
{
public GiftVoucherListModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/GiftVoucherModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/GiftVoucherModel.cs
index c0916439a..b15948a49 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/GiftVoucherModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/GiftVoucherModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Orders
{
- public partial class GiftVoucherModel : BaseEntityModel
+ public class GiftVoucherModel : BaseEntityModel
{
public GiftVoucherModel()
{
@@ -77,7 +77,7 @@ namespace Grand.Web.Admin.Models.Orders
#region Nested classes
- public partial class GiftVoucherUsageHistoryModel : BaseEntityModel
+ public class GiftVoucherUsageHistoryModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.GiftVouchers.History.UsedValue")]
public string UsedValue { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/MerchandiseReturnListModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/MerchandiseReturnListModel.cs
index 822933e03..55c8783d0 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/MerchandiseReturnListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/MerchandiseReturnListModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Orders
{
- public partial class MerchandiseReturnListModel : BaseModel
+ public class MerchandiseReturnListModel : BaseModel
{
public MerchandiseReturnListModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/MerchandiseReturnModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/MerchandiseReturnModel.cs
index b9d3b94f9..c6eaad7a2 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/MerchandiseReturnModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/MerchandiseReturnModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Orders
{
- public partial class MerchandiseReturnModel : BaseEntityModel
+ public class MerchandiseReturnModel : BaseEntityModel
{
public MerchandiseReturnModel()
{
@@ -87,7 +87,7 @@ namespace Grand.Web.Admin.Models.Orders
public string RequestedAction { get; set; }
}
- public partial class MerchandiseReturnNote : BaseEntityModel
+ public class MerchandiseReturnNote : BaseEntityModel
{
public string MerchandiseReturnId { get; set; }
[GrandResourceDisplayName("Admin.Orders.MerchandiseReturns.MerchandiseReturnNotes.Fields.DisplayToCustomer")]
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/NeverSoldReportLineModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/NeverSoldReportLineModel.cs
index 8da1de5c8..aaaaab107 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/NeverSoldReportLineModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/NeverSoldReportLineModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Orders
{
- public partial class NeverSoldReportLineModel : BaseModel
+ public class NeverSoldReportLineModel : BaseModel
{
public string ProductId { get; set; }
[GrandResourceDisplayName("Admin.Reports.NeverSold.Fields.Name")]
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/NeverSoldReportModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/NeverSoldReportModel.cs
index 71071b5de..a85332a0f 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/NeverSoldReportModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/NeverSoldReportModel.cs
@@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Orders
{
- public partial class NeverSoldReportModel : BaseModel
+ public class NeverSoldReportModel : BaseModel
{
[GrandResourceDisplayName("Admin.Reports.NeverSold.StartDate")]
[UIHint("DateNullable")]
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/OrderAddressModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/OrderAddressModel.cs
index d439edbaf..52f6a3af7 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/OrderAddressModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/OrderAddressModel.cs
@@ -3,7 +3,7 @@ using Grand.Web.Admin.Models.Common;
namespace Grand.Web.Admin.Models.Orders
{
- public partial class OrderAddressModel : BaseModel
+ public class OrderAddressModel : BaseModel
{
public string OrderId { get; set; }
public bool BillingAddress { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/OrderAverageReportLineSummaryModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/OrderAverageReportLineSummaryModel.cs
index 69519dad4..d9168a16c 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/OrderAverageReportLineSummaryModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/OrderAverageReportLineSummaryModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Orders
{
- public partial class OrderAverageReportLineSummaryModel : BaseModel
+ public class OrderAverageReportLineSummaryModel : BaseModel
{
[GrandResourceDisplayName("Admin.Reports.Average.OrderStatus")]
public string OrderStatus { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/OrderIncompleteReportLineModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/OrderIncompleteReportLineModel.cs
index 22ec1c8b1..b9bb3fd1f 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/OrderIncompleteReportLineModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/OrderIncompleteReportLineModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Orders
{
- public partial class OrderIncompleteReportLineModel : BaseModel
+ public class OrderIncompleteReportLineModel : BaseModel
{
[GrandResourceDisplayName("Admin.Reports.Incomplete.Item")]
public string Item { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/OrderListModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/OrderListModel.cs
index 8734cf069..ababb5fdb 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/OrderListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/OrderListModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Orders
{
- public partial class OrderListModel : BaseModel
+ public class OrderListModel : BaseModel
{
public OrderListModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/OrderModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/OrderModel.cs
index 62439d6a5..de4d37c64 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/OrderModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/OrderModel.cs
@@ -9,7 +9,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Orders
{
- public partial class OrderModel : BaseEntityModel
+ public class OrderModel : BaseEntityModel
{
public OrderModel()
{
@@ -217,7 +217,7 @@ namespace Grand.Web.Admin.Models.Orders
#region Nested Classes
- public partial class OrderItemModel : BaseEntityModel
+ public class OrderItemModel : BaseEntityModel
{
public OrderItemModel()
{
@@ -268,20 +268,20 @@ namespace Grand.Web.Admin.Models.Orders
public double CommissionValue { get; set; }
}
- public partial class TaxRate : BaseModel
+ public class TaxRate : BaseModel
{
public string Rate { get; set; }
public string Value { get; set; }
}
- public partial class GiftVoucher : BaseModel
+ public class GiftVoucher : BaseModel
{
[GrandResourceDisplayName("Admin.Orders.Fields.GiftVoucherInfo")]
public string CouponCode { get; set; }
public string Amount { get; set; }
}
- public partial class OrderNote : BaseEntityModel
+ public class OrderNote : BaseEntityModel
{
public string OrderId { get; set; }
[GrandResourceDisplayName("Admin.Orders.OrderNotes.Fields.DisplayToCustomer")]
@@ -298,7 +298,7 @@ namespace Grand.Web.Admin.Models.Orders
public bool CreatedByCustomer { get; set; }
}
- public partial class UploadLicenseModel : BaseModel
+ public class UploadLicenseModel : BaseModel
{
public string OrderId { get; set; }
@@ -309,7 +309,7 @@ namespace Grand.Web.Admin.Models.Orders
}
- public partial class AddOrderProductModel : BaseModel
+ public class AddOrderProductModel : BaseModel
{
public AddOrderProductModel()
{
@@ -338,7 +338,7 @@ namespace Grand.Web.Admin.Models.Orders
public int OrderNumber { get; set; }
#region Nested classes
- public partial class ProductModel : BaseEntityModel
+ public class ProductModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Orders.Products.AddNew.Name")]
@@ -349,7 +349,7 @@ namespace Grand.Web.Admin.Models.Orders
public string Sku { get; set; }
}
- public partial class ProductDetailsModel : BaseModel
+ public class ProductDetailsModel : BaseModel
{
public ProductDetailsModel()
{
@@ -387,7 +387,7 @@ namespace Grand.Web.Admin.Models.Orders
}
- public partial class ProductAttributeModel : BaseEntityModel
+ public class ProductAttributeModel : BaseEntityModel
{
public ProductAttributeModel()
{
@@ -407,7 +407,7 @@ namespace Grand.Web.Admin.Models.Orders
public IList<ProductAttributeValueModel> Values { get; set; }
}
- public partial class ProductAttributeValueModel : BaseEntityModel
+ public class ProductAttributeValueModel : BaseEntityModel
{
public string Name { get; set; }
@@ -415,7 +415,7 @@ namespace Grand.Web.Admin.Models.Orders
}
- public partial class GiftVoucherModel : BaseModel
+ public class GiftVoucherModel : BaseModel
{
public bool IsGiftVoucher { get; set; }
@@ -440,7 +440,7 @@ namespace Grand.Web.Admin.Models.Orders
#endregion
}
- public partial class UsedDiscountModel : BaseModel
+ public class UsedDiscountModel : BaseModel
{
public string DiscountId { get; set; }
public string DiscountName { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/OrderPeriodReportLineModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/OrderPeriodReportLineModel.cs
index 35af59c7d..b4bf1a734 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/OrderPeriodReportLineModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/OrderPeriodReportLineModel.cs
@@ -4,7 +4,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Orders
{
- public partial class OrderPeriodReportLineModel : BaseModel
+ public class OrderPeriodReportLineModel : BaseModel
{
[GrandResourceDisplayName("Admin.Reports.Period.Name")]
public string Period { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/OrderStatusModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/OrderStatusModel.cs
index fbda6dd56..464e3448d 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/OrderStatusModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/OrderStatusModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Orders
{
- public partial class OrderStatusModel : BaseEntityModel
+ public class OrderStatusModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Orders.OrderStatus.Fields.Name")]
public string Name { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/OrderTagModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/OrderTagModel.cs
index 185ccd44d..0aca606b1 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/OrderTagModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/OrderTagModel.cs
@@ -19,7 +19,7 @@ namespace Grand.Web.Admin.Models.Orders
public IList<OrderTagLocalizedModel> Locales { get; set; }
}
- public partial class OrderTagLocalizedModel : ILocalizedModelLocal
+ public class OrderTagLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
[GrandResourceDisplayName("Admin.Orders.OrderTags.Fields.Name")]
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/PaymentTransactionListModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/PaymentTransactionListModel.cs
index dd5bd6adf..91633fb12 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/PaymentTransactionListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/PaymentTransactionListModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Orders
{
- public partial class PaymentTransactionListModel : BaseModel
+ public class PaymentTransactionListModel : BaseModel
{
public PaymentTransactionListModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/PaymentTransactionModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/PaymentTransactionModel.cs
index 36a7a8335..90d6b6129 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/PaymentTransactionModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/PaymentTransactionModel.cs
@@ -4,7 +4,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Orders
{
- public partial class PaymentTransactionModel : BaseEntityModel
+ public class PaymentTransactionModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.PaymentTransaction.Fields.PaymentMethodSystemName")]
public string PaymentMethodSystemName { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/ShipmentListModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/ShipmentListModel.cs
index e2deead5b..d1e58e69d 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/ShipmentListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/ShipmentListModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Orders
{
- public partial class ShipmentListModel : BaseModel
+ public class ShipmentListModel : BaseModel
{
public ShipmentListModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Orders/ShipmentModel.cs b/src/Web/Grand.Web.Admin/Models/Orders/ShipmentModel.cs
index e86fe6674..c98ec72e6 100644
--- a/src/Web/Grand.Web.Admin/Models/Orders/ShipmentModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Orders/ShipmentModel.cs
@@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Orders
{
- public partial class ShipmentModel : BaseEntityModel
+ public class ShipmentModel : BaseEntityModel
{
public ShipmentModel()
{
@@ -56,7 +56,7 @@ namespace Grand.Web.Admin.Models.Orders
#region Nested classes
- public partial class ShipmentItemModel : BaseEntityModel
+ public class ShipmentItemModel : BaseEntityModel
{
public ShipmentItemModel()
{
@@ -103,7 +103,7 @@ namespace Grand.Web.Admin.Models.Orders
#endregion
}
- public partial class ShipmentNote : BaseEntityModel
+ public class ShipmentNote : BaseEntityModel
{
public string ShipmentId { get; set; }
[GrandResourceDisplayName("Admin.Orders.Shipments.ShipmentNotes.Fields.DisplayToCustomer")]
@@ -120,7 +120,7 @@ namespace Grand.Web.Admin.Models.Orders
public bool CreatedByCustomer { get; set; }
}
- public partial class ShipmentStatusEventModel : BaseModel
+ public class ShipmentStatusEventModel : BaseModel
{
public string EventName { get; set; }
public string Location { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Pages/PageListModel.cs b/src/Web/Grand.Web.Admin/Models/Pages/PageListModel.cs
index 27f05d219..c76b0645d 100644
--- a/src/Web/Grand.Web.Admin/Models/Pages/PageListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Pages/PageListModel.cs
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Models.Pages
{
- public partial class PageListModel : BaseModel
+ public class PageListModel : BaseModel
{
public PageListModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Pages/PageModel.cs b/src/Web/Grand.Web.Admin/Models/Pages/PageModel.cs
index b97c834ee..d39ccbc32 100644
--- a/src/Web/Grand.Web.Admin/Models/Pages/PageModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Pages/PageModel.cs
@@ -7,7 +7,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Pages
{
- public partial class PageModel : BaseEntityModel, ILocalizedModel<PageLocalizedModel>, IGroupLinkModel, IStoreLinkModel
+ public class PageModel : BaseEntityModel, ILocalizedModel<PageLocalizedModel>, IGroupLinkModel, IStoreLinkModel
{
public PageModel()
{
@@ -99,7 +99,7 @@ namespace Grand.Web.Admin.Models.Pages
public DateTime? EndDateUtc { get; set; }
}
- public partial class PageLocalizedModel : ILocalizedModelLocal, ISlugModelLocal
+ public class PageLocalizedModel : ILocalizedModelLocal, ISlugModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Payments/PaymentMethodModel.cs b/src/Web/Grand.Web.Admin/Models/Payments/PaymentMethodModel.cs
index 15179afff..891cda1b6 100644
--- a/src/Web/Grand.Web.Admin/Models/Payments/PaymentMethodModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Payments/PaymentMethodModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Payments
{
- public partial class PaymentMethodModel : BaseModel
+ public class PaymentMethodModel : BaseModel
{
[GrandResourceDisplayName("Admin.Configuration.Payment.Methods.Fields.FriendlyName")]
diff --git a/src/Web/Grand.Web.Admin/Models/Payments/PaymentMethodRestrictionModel.cs b/src/Web/Grand.Web.Admin/Models/Payments/PaymentMethodRestrictionModel.cs
index b2cafe579..ac0632514 100644
--- a/src/Web/Grand.Web.Admin/Models/Payments/PaymentMethodRestrictionModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Payments/PaymentMethodRestrictionModel.cs
@@ -4,7 +4,7 @@ using Grand.Web.Admin.Models.Shipping;
namespace Grand.Web.Admin.Models.Payments
{
- public partial class PaymentMethodRestrictionModel : BaseModel
+ public class PaymentMethodRestrictionModel : BaseModel
{
public PaymentMethodRestrictionModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Payments/PaymentSettingsModel.cs b/src/Web/Grand.Web.Admin/Models/Payments/PaymentSettingsModel.cs
index 235e0ae15..840608655 100644
--- a/src/Web/Grand.Web.Admin/Models/Payments/PaymentSettingsModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Payments/PaymentSettingsModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Payments
{
- public partial class PaymentSettingsModel : BaseModel
+ public class PaymentSettingsModel : BaseModel
{
[GrandResourceDisplayName("Admin.Configuration.Payment.Settings.AllowRePostingPayments")]
diff --git a/src/Web/Grand.Web.Admin/Models/Permissions/PermissionActionModel.cs b/src/Web/Grand.Web.Admin/Models/Permissions/PermissionActionModel.cs
index b1895c675..e4fadccf8 100644
--- a/src/Web/Grand.Web.Admin/Models/Permissions/PermissionActionModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Permissions/PermissionActionModel.cs
@@ -2,7 +2,7 @@
namespace Grand.Web.Admin.Models.Permissions
{
- public partial class PermissionActionModel : BaseModel
+ public class PermissionActionModel : BaseModel
{
public PermissionActionModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Permissions/PermissionMappingModel.cs b/src/Web/Grand.Web.Admin/Models/Permissions/PermissionMappingModel.cs
index be5992ade..36edaa4e4 100644
--- a/src/Web/Grand.Web.Admin/Models/Permissions/PermissionMappingModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Permissions/PermissionMappingModel.cs
@@ -3,7 +3,7 @@ using Grand.Web.Common.Models;
namespace Grand.Web.Admin.Models.Permissions
{
- public partial class PermissionMappingModel : BaseModel
+ public class PermissionMappingModel : BaseModel
{
public PermissionMappingModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Permissions/PermissionRecordModel.cs b/src/Web/Grand.Web.Admin/Models/Permissions/PermissionRecordModel.cs
index 3b87ecd3b..7067cf50a 100644
--- a/src/Web/Grand.Web.Admin/Models/Permissions/PermissionRecordModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Permissions/PermissionRecordModel.cs
@@ -2,7 +2,7 @@
namespace Grand.Web.Admin.Models.Permissions
{
- public partial class PermissionRecordModel : BaseModel
+ public class PermissionRecordModel : BaseModel
{
public string Name { get; set; }
public string SystemName { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Plugins/MiscPluginModel.cs b/src/Web/Grand.Web.Admin/Models/Plugins/MiscPluginModel.cs
index 38e87cab8..7e58daf39 100644
--- a/src/Web/Grand.Web.Admin/Models/Plugins/MiscPluginModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Plugins/MiscPluginModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Plugins
{
- public partial class MiscPluginModel : BaseModel
+ public class MiscPluginModel : BaseModel
{
public string FriendlyName { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Plugins/OfficialFeedListModel.cs b/src/Web/Grand.Web.Admin/Models/Plugins/OfficialFeedListModel.cs
deleted file mode 100644
index 4fc47bc76..000000000
--- a/src/Web/Grand.Web.Admin/Models/Plugins/OfficialFeedListModel.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using Grand.Infrastructure.ModelBinding;
-using Grand.Infrastructure.Models;
-using Microsoft.AspNetCore.Mvc.Rendering;
-
-namespace Grand.Web.Admin.Models.Plugins
-{
- public partial class OfficialFeedListModel : BaseModel
- {
- public OfficialFeedListModel()
- {
- AvailableVersions = new List<SelectListItem>();
- AvailableCategories = new List<SelectListItem>();
- AvailablePrices = new List<SelectListItem>();
- }
-
- [GrandResourceDisplayName("Admin.Plugins.OfficialFeed.Name")]
-
- public string SearchName { get; set; }
- [GrandResourceDisplayName("Admin.Plugins.OfficialFeed.Version")]
- public int SearchVersionId { get; set; }
- [GrandResourceDisplayName("Admin.Plugins.OfficialFeed.Category")]
- public string SearchCategoryId { get; set; }
- [GrandResourceDisplayName("Admin.Plugins.OfficialFeed.Price")]
- public int SearchPriceId { get; set; }
-
-
- [GrandResourceDisplayName("Admin.Plugins.OfficialFeed.Version")]
- public IList<SelectListItem> AvailableVersions { get; set; }
- [GrandResourceDisplayName("Admin.Plugins.OfficialFeed.Category")]
- public IList<SelectListItem> AvailableCategories { get; set; }
- [GrandResourceDisplayName("Admin.Plugins.OfficialFeed.Price")]
- public IList<SelectListItem> AvailablePrices { get; set; }
-
- #region Nested classes
-
- public partial class ItemOverview
- {
- public string Url { get; set; }
- public string Name { get; set; }
- public string CategoryName { get; set; }
- public string SupportedVersions { get; set; }
- public string PictureUrl { get; set; }
- public string Price { get; set; }
- }
-
- #endregion
- }
-}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Models/Plugins/PluginListModel.cs b/src/Web/Grand.Web.Admin/Models/Plugins/PluginListModel.cs
index 18890dc67..6b8ae09ed 100644
--- a/src/Web/Grand.Web.Admin/Models/Plugins/PluginListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Plugins/PluginListModel.cs
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Models.Plugins
{
- public partial class PluginListModel : BaseModel
+ public class PluginListModel : BaseModel
{
public PluginListModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Plugins/PluginModel.cs b/src/Web/Grand.Web.Admin/Models/Plugins/PluginModel.cs
index 8f8bc58ae..a0afe9508 100644
--- a/src/Web/Grand.Web.Admin/Models/Plugins/PluginModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Plugins/PluginModel.cs
@@ -3,11 +3,8 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Plugins
{
- public partial class PluginModel : BaseModel
+ public class PluginModel : BaseModel
{
- public PluginModel()
- {
- }
[GrandResourceDisplayName("Admin.Plugins.Fields.Group")]
public string Group { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/PushNotifications/PushModel.cs b/src/Web/Grand.Web.Admin/Models/PushNotifications/PushModel.cs
index 541e28849..d5c209521 100644
--- a/src/Web/Grand.Web.Admin/Models/PushNotifications/PushModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/PushNotifications/PushModel.cs
@@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.PushNotifications
{
- public partial class PushModel : BaseModel
+ public class PushModel : BaseModel
{
[GrandResourceDisplayName("Admin.PushNotifications.Fields.PushTitle")]
public string Title { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Settings/CatalogSettingsModel.cs b/src/Web/Grand.Web.Admin/Models/Settings/CatalogSettingsModel.cs
index bc3971bc6..030ac0478 100644
--- a/src/Web/Grand.Web.Admin/Models/Settings/CatalogSettingsModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Settings/CatalogSettingsModel.cs
@@ -4,13 +4,13 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Models.Settings
{
- public partial class CatalogSettingsModel : BaseModel
+ public class CatalogSettingsModel : BaseModel
{
public CatalogSettingsModel()
{
DefaultViewModes = new List<SelectListItem>();
- DefaultViewModes.Add(new SelectListItem() { Text = "grid", Value = "grid" });
- DefaultViewModes.Add(new SelectListItem() { Text = "list", Value = "list" });
+ DefaultViewModes.Add(new SelectListItem { Text = "grid", Value = "grid" });
+ DefaultViewModes.Add(new SelectListItem { Text = "list", Value = "list" });
}
diff --git a/src/Web/Grand.Web.Admin/Models/Settings/ContentSettingsModel.cs b/src/Web/Grand.Web.Admin/Models/Settings/ContentSettingsModel.cs
index 41f5f8d45..d08a7b4ab 100644
--- a/src/Web/Grand.Web.Admin/Models/Settings/ContentSettingsModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Settings/ContentSettingsModel.cs
@@ -18,7 +18,7 @@ namespace Grand.Web.Admin.Models.Settings
public NewsSettingsModel NewsSettings { get; set; }
public KnowledgebaseSettingsModel KnowledgebaseSettings { get; set; }
- public partial class BlogSettingsModel : BaseModel
+ public class BlogSettingsModel : BaseModel
{
[GrandResourceDisplayName("Admin.Settings.Blog.Enabled")]
@@ -49,7 +49,7 @@ namespace Grand.Web.Admin.Models.Settings
public bool ShowBlogPostsInSearchAutoComplete { get; set; }
}
- public partial class NewsSettingsModel : BaseModel
+ public class NewsSettingsModel : BaseModel
{
[GrandResourceDisplayName("Admin.Settings.News.Enabled")]
public bool Enabled { get; set; }
@@ -71,7 +71,7 @@ namespace Grand.Web.Admin.Models.Settings
}
- public partial class KnowledgebaseSettingsModel : BaseModel
+ public class KnowledgebaseSettingsModel : BaseModel
{
[GrandResourceDisplayName("Admin.Settings.GeneralCommon.KnowledgebaseSettings.Enabled")]
public bool Enabled { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Settings/CustomerSettingsModel.cs b/src/Web/Grand.Web.Admin/Models/Settings/CustomerSettingsModel.cs
index c7a168375..472fa1e7f 100644
--- a/src/Web/Grand.Web.Admin/Models/Settings/CustomerSettingsModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Settings/CustomerSettingsModel.cs
@@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Settings
{
- public partial class CustomerSettingsModel : BaseModel
+ public class CustomerSettingsModel : BaseModel
{
public CustomerSettingsModel()
{
@@ -17,7 +17,7 @@ namespace Grand.Web.Admin.Models.Settings
#region Nested classes
- public partial class CustomersSettingsModel : BaseModel
+ public class CustomersSettingsModel : BaseModel
{
[GrandResourceDisplayName("Admin.Settings.Customer.FirstLastNameRequired")]
public bool FirstLastNameRequired { get; set; }
@@ -192,7 +192,7 @@ namespace Grand.Web.Admin.Models.Settings
public HashedPasswordFormat HashedPasswordFormat { get; set; }
}
- public partial class AddressSettingsModel : BaseModel
+ public class AddressSettingsModel : BaseModel
{
[GrandResourceDisplayName("Admin.Settings.Customer.AddressFormFields.NameEnabled")]
public bool NameEnabled { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Settings/GeneralCommonSettingsModel.cs b/src/Web/Grand.Web.Admin/Models/Settings/GeneralCommonSettingsModel.cs
index c1043b0ec..cdd2ac72f 100644
--- a/src/Web/Grand.Web.Admin/Models/Settings/GeneralCommonSettingsModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Settings/GeneralCommonSettingsModel.cs
@@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Settings
{
- public partial class GeneralCommonSettingsModel : BaseModel
+ public class GeneralCommonSettingsModel : BaseModel
{
public GeneralCommonSettingsModel()
{
@@ -16,7 +16,6 @@ namespace Grand.Web.Admin.Models.Settings
SeoSettings = new SeoSettingsModel();
SecuritySettings = new SecuritySettingsModel();
PdfSettings = new PdfSettingsModel();
- GoogleAnalyticsSettings = new GoogleAnalyticsSettingsModel();
DisplayMenuSettings = new DisplayMenuSettingsModel();
}
public string ActiveStore { get; set; }
@@ -26,13 +25,12 @@ namespace Grand.Web.Admin.Models.Settings
public SeoSettingsModel SeoSettings { get; set; }
public SecuritySettingsModel SecuritySettings { get; set; }
public PdfSettingsModel PdfSettings { get; set; }
- public GoogleAnalyticsSettingsModel GoogleAnalyticsSettings { get; set; }
public DisplayMenuSettingsModel DisplayMenuSettings { get; set; }
#region Nested classes
- public partial class StoreInformationSettingsModel : BaseModel
+ public class StoreInformationSettingsModel : BaseModel
{
public StoreInformationSettingsModel()
{
@@ -86,7 +84,7 @@ namespace Grand.Web.Admin.Models.Settings
#region Nested classes
- public partial class ThemeConfigurationModel
+ public class ThemeConfigurationModel
{
public string ThemeName { get; set; }
public string ThemeVersion { get; set; }
@@ -100,7 +98,7 @@ namespace Grand.Web.Admin.Models.Settings
#endregion
}
- public partial class CommonSettingsModel : BaseModel
+ public class CommonSettingsModel : BaseModel
{
[GrandResourceDisplayName("Admin.Settings.GeneralCommon.StoreInDatabaseContactUsForm")]
@@ -141,7 +139,7 @@ namespace Grand.Web.Admin.Models.Settings
}
- public partial class DateTimeSettingsModel : BaseModel
+ public class DateTimeSettingsModel : BaseModel
{
public DateTimeSettingsModel()
{
@@ -155,7 +153,7 @@ namespace Grand.Web.Admin.Models.Settings
public IList<SelectListItem> AvailableTimeZones { get; set; }
}
- public partial class SeoSettingsModel : BaseModel
+ public class SeoSettingsModel : BaseModel
{
[GrandResourceDisplayName("Admin.Settings.GeneralCommon.PageTitleSeparator")]
@@ -212,7 +210,7 @@ namespace Grand.Web.Admin.Models.Settings
}
- public partial class SecuritySettingsModel : BaseModel
+ public class SecuritySettingsModel : BaseModel
{
public SecuritySettingsModel()
{
@@ -282,7 +280,7 @@ namespace Grand.Web.Admin.Models.Settings
public IList<SelectListItem> AvailableReCaptchaVersions { get; set; }
}
- public partial class PdfSettingsModel : BaseModel
+ public class PdfSettingsModel : BaseModel
{
[GrandResourceDisplayName("Admin.Settings.GeneralCommon.PdfLogo")]
[UIHint("Picture")]
@@ -298,20 +296,7 @@ namespace Grand.Web.Admin.Models.Settings
public string InvoiceFooterText { get; set; }
}
- public partial class GoogleAnalyticsSettingsModel : BaseModel
- {
- [GrandResourceDisplayName("Admin.Settings.GeneralCommon.GoogleAnalyticsPrivateKey")]
- public string GaprivateKey { get; set; }
-
- [GrandResourceDisplayName("Admin.Settings.GeneralCommon.GoogleAnalyticsServiceAccountEmail")]
- public string GaserviceAccountEmail { get; set; }
-
- [GrandResourceDisplayName("Admin.Settings.GeneralCommon.GoogleAnalyticsViewID")]
- public string GaviewID { get; set; }
-
- }
-
- public partial class DisplayMenuSettingsModel : BaseModel
+ public class DisplayMenuSettingsModel : BaseModel
{
[GrandResourceDisplayName("Admin.Settings.GeneralCommon.DisplayMenuSettings.DisplayHomePageMenu")]
public bool DisplayHomePageMenu { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Settings/MediaSettingsModel.cs b/src/Web/Grand.Web.Admin/Models/Settings/MediaSettingsModel.cs
index f11f0202e..015884a12 100644
--- a/src/Web/Grand.Web.Admin/Models/Settings/MediaSettingsModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Settings/MediaSettingsModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Settings
{
- public partial class MediaSettingsModel : BaseModel
+ public class MediaSettingsModel : BaseModel
{
#region Standard Media Settings
public string ActiveStore { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Settings/MerchandiseReturnActionModel.cs b/src/Web/Grand.Web.Admin/Models/Settings/MerchandiseReturnActionModel.cs
index dc67cc499..b28ab9e32 100644
--- a/src/Web/Grand.Web.Admin/Models/Settings/MerchandiseReturnActionModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Settings/MerchandiseReturnActionModel.cs
@@ -4,7 +4,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Settings
{
- public partial class MerchandiseReturnActionModel : BaseEntityModel, ILocalizedModel<MerchandiseReturnActionLocalizedModel>
+ public class MerchandiseReturnActionModel : BaseEntityModel, ILocalizedModel<MerchandiseReturnActionLocalizedModel>
{
public MerchandiseReturnActionModel()
{
@@ -21,7 +21,7 @@ namespace Grand.Web.Admin.Models.Settings
public IList<MerchandiseReturnActionLocalizedModel> Locales { get; set; }
}
- public partial class MerchandiseReturnActionLocalizedModel : ILocalizedModelLocal
+ public class MerchandiseReturnActionLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Settings/MerchandiseReturnReasonModel.cs b/src/Web/Grand.Web.Admin/Models/Settings/MerchandiseReturnReasonModel.cs
index cd8098679..cf48839af 100644
--- a/src/Web/Grand.Web.Admin/Models/Settings/MerchandiseReturnReasonModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Settings/MerchandiseReturnReasonModel.cs
@@ -4,7 +4,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Settings
{
- public partial class MerchandiseReturnReasonModel : BaseEntityModel, ILocalizedModel<MerchandiseReturnReasonLocalizedModel>
+ public class MerchandiseReturnReasonModel : BaseEntityModel, ILocalizedModel<MerchandiseReturnReasonLocalizedModel>
{
public MerchandiseReturnReasonModel()
{
@@ -21,7 +21,7 @@ namespace Grand.Web.Admin.Models.Settings
public IList<MerchandiseReturnReasonLocalizedModel> Locales { get; set; }
}
- public partial class MerchandiseReturnReasonLocalizedModel : ILocalizedModelLocal
+ public class MerchandiseReturnReasonLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Settings/SalesSettingsModel.cs b/src/Web/Grand.Web.Admin/Models/Settings/SalesSettingsModel.cs
index d84872e31..0bdcd44d7 100644
--- a/src/Web/Grand.Web.Admin/Models/Settings/SalesSettingsModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Settings/SalesSettingsModel.cs
@@ -18,7 +18,7 @@ namespace Grand.Web.Admin.Models.Settings
public ShoppingCartSettingsModel ShoppingCartSettings { get; set; }
public LoyaltyPointsSettingsModel LoyaltyPointsSettings { get; set; }
- public partial class OrderSettingsModel : BaseModel
+ public class OrderSettingsModel : BaseModel
{
public OrderSettingsModel()
{
@@ -114,7 +114,7 @@ namespace Grand.Web.Admin.Models.Settings
}
- public partial class ShoppingCartSettingsModel : BaseModel
+ public class ShoppingCartSettingsModel : BaseModel
{
[GrandResourceDisplayName("Admin.Settings.ShoppingCart.DisplayCartAfterAddingProduct")]
public bool DisplayCartAfterAddingProduct { get; set; }
@@ -186,7 +186,7 @@ namespace Grand.Web.Admin.Models.Settings
public string ReservationDateFormat { get; set; }
}
- public partial class LoyaltyPointsSettingsModel : BaseModel
+ public class LoyaltyPointsSettingsModel : BaseModel
{
public LoyaltyPointsSettingsModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Settings/SettingModel.cs b/src/Web/Grand.Web.Admin/Models/Settings/SettingModel.cs
index 34b1926c6..da94d7be3 100644
--- a/src/Web/Grand.Web.Admin/Models/Settings/SettingModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Settings/SettingModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Settings
{
- public partial class SettingModel : BaseEntityModel
+ public class SettingModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Settings.AllSettings.Fields.Name")]
diff --git a/src/Web/Grand.Web.Admin/Models/Settings/SortOptionModel.cs b/src/Web/Grand.Web.Admin/Models/Settings/SortOptionModel.cs
index 35522d616..9dc52c985 100644
--- a/src/Web/Grand.Web.Admin/Models/Settings/SortOptionModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Settings/SortOptionModel.cs
@@ -2,7 +2,7 @@
namespace Grand.Web.Admin.Models.Settings
{
- public partial class SortOptionModel
+ public class SortOptionModel
{
public virtual int Id { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Settings/StoreScopeModel.cs b/src/Web/Grand.Web.Admin/Models/Settings/StoreScopeModel.cs
index 30a8467c8..f4f9c7508 100644
--- a/src/Web/Grand.Web.Admin/Models/Settings/StoreScopeModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Settings/StoreScopeModel.cs
@@ -3,7 +3,7 @@ using Grand.Web.Common.Models;
namespace Grand.Web.Admin.Models.Settings
{
- public partial class StoreScopeModel : BaseModel
+ public class StoreScopeModel : BaseModel
{
public StoreScopeModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Settings/VendorSettingsModel.cs b/src/Web/Grand.Web.Admin/Models/Settings/VendorSettingsModel.cs
index a664d4323..093a6c0ee 100644
--- a/src/Web/Grand.Web.Admin/Models/Settings/VendorSettingsModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Settings/VendorSettingsModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Settings
{
- public partial class VendorSettingsModel : BaseModel
+ public class VendorSettingsModel : BaseModel
{
public VendorSettingsModel()
@@ -73,7 +73,7 @@ namespace Grand.Web.Admin.Models.Settings
#region Nested classes
- public partial class AddressSettingsModel : BaseModel
+ public class AddressSettingsModel : BaseModel
{
[GrandResourceDisplayName("Admin.Settings.Vendor.AddressFormFields.CompanyEnabled")]
public bool CompanyEnabled { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Shipping/DeliveryDateModel.cs b/src/Web/Grand.Web.Admin/Models/Shipping/DeliveryDateModel.cs
index 0520bfc23..07deab5c2 100644
--- a/src/Web/Grand.Web.Admin/Models/Shipping/DeliveryDateModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Shipping/DeliveryDateModel.cs
@@ -4,7 +4,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Shipping
{
- public partial class DeliveryDateModel : BaseEntityModel, ILocalizedModel<DeliveryDateLocalizedModel>
+ public class DeliveryDateModel : BaseEntityModel, ILocalizedModel<DeliveryDateLocalizedModel>
{
public DeliveryDateModel()
{
@@ -24,7 +24,7 @@ namespace Grand.Web.Admin.Models.Shipping
public IList<DeliveryDateLocalizedModel> Locales { get; set; }
}
- public partial class DeliveryDateLocalizedModel : ILocalizedModelLocal
+ public class DeliveryDateLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Shipping/PickupPointModel.cs b/src/Web/Grand.Web.Admin/Models/Shipping/PickupPointModel.cs
index f48baa87e..1f7670dc8 100644
--- a/src/Web/Grand.Web.Admin/Models/Shipping/PickupPointModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Shipping/PickupPointModel.cs
@@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Models.Shipping
{
- public partial class PickupPointModel : BaseEntityModel
+ public class PickupPointModel : BaseEntityModel
{
public PickupPointModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Shipping/ShippingMethodModel.cs b/src/Web/Grand.Web.Admin/Models/Shipping/ShippingMethodModel.cs
index f9ddd962a..b5cd15d24 100644
--- a/src/Web/Grand.Web.Admin/Models/Shipping/ShippingMethodModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Shipping/ShippingMethodModel.cs
@@ -4,7 +4,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Shipping
{
- public partial class ShippingMethodModel : BaseEntityModel, ILocalizedModel<ShippingMethodLocalizedModel>
+ public class ShippingMethodModel : BaseEntityModel, ILocalizedModel<ShippingMethodLocalizedModel>
{
public ShippingMethodModel()
{
@@ -24,7 +24,7 @@ namespace Grand.Web.Admin.Models.Shipping
public IList<ShippingMethodLocalizedModel> Locales { get; set; }
}
- public partial class ShippingMethodLocalizedModel : ILocalizedModelLocal
+ public class ShippingMethodLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Shipping/ShippingMethodRestrictionModel.cs b/src/Web/Grand.Web.Admin/Models/Shipping/ShippingMethodRestrictionModel.cs
index 5a41091cc..fd76c6f9c 100644
--- a/src/Web/Grand.Web.Admin/Models/Shipping/ShippingMethodRestrictionModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Shipping/ShippingMethodRestrictionModel.cs
@@ -4,7 +4,7 @@ using Grand.Web.Admin.Models.Directory;
namespace Grand.Web.Admin.Models.Shipping
{
- public partial class ShippingMethodRestrictionModel : BaseModel
+ public class ShippingMethodRestrictionModel : BaseModel
{
public ShippingMethodRestrictionModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Shipping/ShippingRateComputationMethodModel.cs b/src/Web/Grand.Web.Admin/Models/Shipping/ShippingRateComputationMethodModel.cs
index 72a829958..486a1e73b 100644
--- a/src/Web/Grand.Web.Admin/Models/Shipping/ShippingRateComputationMethodModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Shipping/ShippingRateComputationMethodModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Shipping
{
- public partial class ShippingRateComputationMethodModel : BaseModel
+ public class ShippingRateComputationMethodModel : BaseModel
{
[GrandResourceDisplayName("Admin.Configuration.Shipping.Providers.Fields.FriendlyName")]
diff --git a/src/Web/Grand.Web.Admin/Models/Shipping/ShippingSettingsModel.cs b/src/Web/Grand.Web.Admin/Models/Shipping/ShippingSettingsModel.cs
index e8df70805..5eb7792ac 100644
--- a/src/Web/Grand.Web.Admin/Models/Shipping/ShippingSettingsModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Shipping/ShippingSettingsModel.cs
@@ -4,7 +4,7 @@ using Grand.Web.Admin.Models.Common;
namespace Grand.Web.Admin.Models.Shipping
{
- public partial class ShippingSettingsModel : BaseModel
+ public class ShippingSettingsModel : BaseModel
{
public string ActiveStore { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Shipping/WarehouseModel.cs b/src/Web/Grand.Web.Admin/Models/Shipping/WarehouseModel.cs
index ef11f507c..6a907f5c7 100644
--- a/src/Web/Grand.Web.Admin/Models/Shipping/WarehouseModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Shipping/WarehouseModel.cs
@@ -4,7 +4,7 @@ using Grand.Web.Admin.Models.Common;
namespace Grand.Web.Admin.Models.Shipping
{
- public partial class WarehouseModel : BaseEntityModel
+ public class WarehouseModel : BaseEntityModel
{
public WarehouseModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/ShoppingCart/ShoppingCartItemModel.cs b/src/Web/Grand.Web.Admin/Models/ShoppingCart/ShoppingCartItemModel.cs
index 3293746f7..7fff9e147 100644
--- a/src/Web/Grand.Web.Admin/Models/ShoppingCart/ShoppingCartItemModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/ShoppingCart/ShoppingCartItemModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.ShoppingCart
{
- public partial class ShoppingCartItemModel : BaseEntityModel
+ public class ShoppingCartItemModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.CurrentCarts.Store")]
public string Store { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/ShoppingCart/ShoppingCartModel.cs b/src/Web/Grand.Web.Admin/Models/ShoppingCart/ShoppingCartModel.cs
index 64e449e94..91b71dafc 100644
--- a/src/Web/Grand.Web.Admin/Models/ShoppingCart/ShoppingCartModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/ShoppingCart/ShoppingCartModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.ShoppingCart
{
- public partial class ShoppingCartModel : BaseModel
+ public class ShoppingCartModel : BaseModel
{
[GrandResourceDisplayName("Admin.CurrentCarts.Customer")]
public string CustomerId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Stores/StoreModel.cs b/src/Web/Grand.Web.Admin/Models/Stores/StoreModel.cs
index f3887083c..b1c6ed733 100644
--- a/src/Web/Grand.Web.Admin/Models/Stores/StoreModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Stores/StoreModel.cs
@@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Models.Stores
{
- public partial class StoreModel : BaseEntityModel, ILocalizedModel<StoreLocalizedModel>
+ public class StoreModel : BaseEntityModel, ILocalizedModel<StoreLocalizedModel>
{
public StoreModel()
{
@@ -96,7 +96,7 @@ namespace Grand.Web.Admin.Models.Stores
}
}
- public partial class StoreLocalizedModel : ILocalizedModelLocal
+ public class StoreLocalizedModel : ILocalizedModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Tasks/ScheduleTaskModel.cs b/src/Web/Grand.Web.Admin/Models/Tasks/ScheduleTaskModel.cs
index 2b5d4ea85..80b3c231c 100644
--- a/src/Web/Grand.Web.Admin/Models/Tasks/ScheduleTaskModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Tasks/ScheduleTaskModel.cs
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Models.Tasks
{
- public partial class ScheduleTaskModel : BaseEntityModel
+ public class ScheduleTaskModel : BaseEntityModel
{
public ScheduleTaskModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Tax/TaxCategoryModel.cs b/src/Web/Grand.Web.Admin/Models/Tax/TaxCategoryModel.cs
index d950370b3..369b9a54a 100644
--- a/src/Web/Grand.Web.Admin/Models/Tax/TaxCategoryModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Tax/TaxCategoryModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Tax
{
- public partial class TaxCategoryModel : BaseEntityModel
+ public class TaxCategoryModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.Configuration.Tax.Categories.Fields.Name")]
diff --git a/src/Web/Grand.Web.Admin/Models/Tax/TaxProviderModel.cs b/src/Web/Grand.Web.Admin/Models/Tax/TaxProviderModel.cs
index 56fc843cb..fec0464aa 100644
--- a/src/Web/Grand.Web.Admin/Models/Tax/TaxProviderModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Tax/TaxProviderModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Tax
{
- public partial class TaxProviderModel : BaseModel
+ public class TaxProviderModel : BaseModel
{
[GrandResourceDisplayName("Admin.Configuration.Tax.Providers.Fields.FriendlyName")]
diff --git a/src/Web/Grand.Web.Admin/Models/Tax/TaxSettingsModel.cs b/src/Web/Grand.Web.Admin/Models/Tax/TaxSettingsModel.cs
index 777069450..e75dc71a5 100644
--- a/src/Web/Grand.Web.Admin/Models/Tax/TaxSettingsModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Tax/TaxSettingsModel.cs
@@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Models.Tax
{
- public partial class TaxSettingsModel : BaseModel
+ public class TaxSettingsModel : BaseModel
{
public TaxSettingsModel()
{
diff --git a/src/Web/Grand.Web.Admin/Models/Vendors/VendorListModel.cs b/src/Web/Grand.Web.Admin/Models/Vendors/VendorListModel.cs
index c1778e577..1b5cfcb52 100644
--- a/src/Web/Grand.Web.Admin/Models/Vendors/VendorListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Vendors/VendorListModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Vendors
{
- public partial class VendorListModel : BaseModel
+ public class VendorListModel : BaseModel
{
[GrandResourceDisplayName("Admin.Vendors.List.SearchName")]
diff --git a/src/Web/Grand.Web.Admin/Models/Vendors/VendorModel.cs b/src/Web/Grand.Web.Admin/Models/Vendors/VendorModel.cs
index 9eaf2eb40..7d717b59c 100644
--- a/src/Web/Grand.Web.Admin/Models/Vendors/VendorModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Vendors/VendorModel.cs
@@ -8,7 +8,7 @@ using System.ComponentModel.DataAnnotations;
namespace Grand.Web.Admin.Models.Vendors
{
- public partial class VendorModel : BaseEntityModel, ILocalizedModel<VendorLocalizedModel>
+ public class VendorModel : BaseEntityModel, ILocalizedModel<VendorLocalizedModel>
{
public VendorModel()
{
@@ -106,7 +106,7 @@ namespace Grand.Web.Admin.Models.Vendors
}
- public partial class VendorNote : BaseEntityModel
+ public class VendorNote : BaseEntityModel
{
public string VendorId { get; set; }
[GrandResourceDisplayName("Admin.Vendors.VendorNotes.Fields.Note")]
@@ -118,7 +118,7 @@ namespace Grand.Web.Admin.Models.Vendors
}
- public partial class VendorLocalizedModel : ILocalizedModelLocal, ISlugModelLocal
+ public class VendorLocalizedModel : ILocalizedModelLocal, ISlugModelLocal
{
public string LanguageId { get; set; }
diff --git a/src/Web/Grand.Web.Admin/Models/Vendors/VendorReviewListModel.cs b/src/Web/Grand.Web.Admin/Models/Vendors/VendorReviewListModel.cs
index aea2fc0b9..2545a9d49 100644
--- a/src/Web/Grand.Web.Admin/Models/Vendors/VendorReviewListModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Vendors/VendorReviewListModel.cs
@@ -2,9 +2,9 @@
using Grand.Infrastructure.Models;
using System.ComponentModel.DataAnnotations;
-namespace Grand.Web.Admin.Models.Customers
+namespace Grand.Web.Admin.Models.Vendors
{
- public partial class VendorReviewListModel : BaseModel
+ public class VendorReviewListModel : BaseModel
{
[GrandResourceDisplayName("Admin.VendorReviews.List.CreatedOnFrom")]
[UIHint("DateNullable")]
diff --git a/src/Web/Grand.Web.Admin/Models/Vendors/VendorReviewModel.cs b/src/Web/Grand.Web.Admin/Models/Vendors/VendorReviewModel.cs
index 80763ffb6..e3a8eca7a 100644
--- a/src/Web/Grand.Web.Admin/Models/Vendors/VendorReviewModel.cs
+++ b/src/Web/Grand.Web.Admin/Models/Vendors/VendorReviewModel.cs
@@ -3,7 +3,7 @@ using Grand.Infrastructure.Models;
namespace Grand.Web.Admin.Models.Vendors
{
- public partial class VendorReviewModel : BaseEntityModel
+ public class VendorReviewModel : BaseEntityModel
{
[GrandResourceDisplayName("Admin.VendorReviews.Fields.Vendor")]
public string VendorId { get; set; }
@@ -12,7 +12,7 @@ namespace Grand.Web.Admin.Models.Vendors
public string Ids {
get {
- return Id.ToString() + ":" + VendorId;
+ return Id + ":" + VendorId;
}
}
[GrandResourceDisplayName("Admin.VendorReviews.Fields.Customer")]
diff --git a/src/Web/Grand.Web.Admin/Program.cs b/src/Web/Grand.Web.Admin/Program.cs
index bc19ef3f2..56488e919 100644
--- a/src/Web/Grand.Web.Admin/Program.cs
+++ b/src/Web/Grand.Web.Admin/Program.cs
@@ -11,7 +11,7 @@ Common.WwwRoot = "";
var builder = WebApplication.CreateBuilder(args);
-builder.Host.UseDefaultServiceProvider((context, options) =>
+builder.Host.UseDefaultServiceProvider((_, options) =>
{
options.ValidateScopes = false;
options.ValidateOnBuild = false;
@@ -51,7 +51,7 @@ if (config.AllowNonAsciiCharInHeaders)
{
builder.WebHost.ConfigureKestrel(options =>
{
- options.ResponseHeaderEncodingSelector = (_) => Encoding.UTF8;
+ options.ResponseHeaderEncodingSelector = _ => Encoding.UTF8;
});
}
if (config.MaxRequestBodySize.HasValue)
diff --git a/src/Web/Grand.Web.Admin/Properties/launchSettings.json b/src/Web/Grand.Web.Admin/Properties/launchSettings.json
index 3a1050ae6..af8a0c0fa 100644
--- a/src/Web/Grand.Web.Admin/Properties/launchSettings.json
+++ b/src/Web/Grand.Web.Admin/Properties/launchSettings.json
@@ -11,6 +11,7 @@
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
+ "launchUrl": "https://localhost:44343/admin",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
diff --git a/src/Web/Grand.Web.Admin/Services/ActivityLogViewModelService.cs b/src/Web/Grand.Web.Admin/Services/ActivityLogViewModelService.cs
index b3188ffe2..3ce42d7e1 100644
--- a/src/Web/Grand.Web.Admin/Services/ActivityLogViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/ActivityLogViewModelService.cs
@@ -5,14 +5,14 @@ using Grand.Business.Core.Interfaces.Cms;
using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Common.Logging;
using Grand.Business.Core.Interfaces.Customers;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Logging;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Services
{
- public partial class ActivityLogViewModelService : IActivityLogViewModelService
+ public class ActivityLogViewModelService : IActivityLogViewModelService
{
private readonly ICustomerActivityService _customerActivityService;
private readonly IDateTimeService _dateTimeService;
@@ -64,7 +64,7 @@ namespace Grand.Web.Admin.Services
{
activityLogSearchModel.ActivityLogType.Add(new SelectListItem
{
- Value = at.Id.ToString(),
+ Value = at.Id,
Text = at.Name
});
}
@@ -73,11 +73,11 @@ namespace Grand.Web.Admin.Services
public virtual async Task<(IEnumerable<ActivityLogModel> activityLogs, int totalCount)> PrepareActivityLogModel(ActivityLogSearchModel model, int pageIndex, int pageSize)
{
- DateTime? startDateValue = (model.CreatedOnFrom == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.CreatedOnFrom.Value, _dateTimeService.CurrentTimeZone);
+ DateTime? startDateValue = model.CreatedOnFrom == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.CreatedOnFrom.Value, _dateTimeService.CurrentTimeZone);
- DateTime? endDateValue = (model.CreatedOnTo == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.CreatedOnTo.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
+ DateTime? endDateValue = model.CreatedOnTo == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.CreatedOnTo.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
var activityLog = await _customerActivityService.GetAllActivities(model.Comment, startDateValue, endDateValue, null, model.ActivityLogTypeId, model.IpAddress, pageIndex - 1, pageSize);
var activityLogModel = new List<ActivityLogModel>();
@@ -97,18 +97,18 @@ namespace Grand.Web.Admin.Services
public virtual async Task<(IEnumerable<ActivityStatsModel> activityStats, int totalCount)> PrepareActivityStatModel(ActivityLogSearchModel model, int pageIndex, int pageSize)
{
- DateTime? startDateValue = (model.CreatedOnFrom == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.CreatedOnFrom.Value, _dateTimeService.CurrentTimeZone);
+ DateTime? startDateValue = model.CreatedOnFrom == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.CreatedOnFrom.Value, _dateTimeService.CurrentTimeZone);
- DateTime? endDateValue = (model.CreatedOnTo == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.CreatedOnTo.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
+ DateTime? endDateValue = model.CreatedOnTo == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.CreatedOnTo.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
var activityStat = await _customerActivityService.GetStatsActivities(startDateValue, endDateValue, model.ActivityLogTypeId, pageIndex - 1, pageSize);
var activityStatModel = new List<ActivityStatsModel>();
foreach (var x in activityStat)
{
var activityLogType = await _customerActivityService.GetActivityTypeById(x.ActivityLogTypeId);
- string _name = "-empty-";
+ var _name = "-empty-";
if (activityLogType != null)
{
IList<string> systemKeywordsCategory = new List<string>();
diff --git a/src/Web/Grand.Web.Admin/Services/AddressAttributeViewModelService.cs b/src/Web/Grand.Web.Admin/Services/AddressAttributeViewModelService.cs
index 732245068..abd7de6da 100644
--- a/src/Web/Grand.Web.Admin/Services/AddressAttributeViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/AddressAttributeViewModelService.cs
@@ -3,13 +3,13 @@ using Grand.Business.Core.Interfaces.Common.Addresses;
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Infrastructure;
using Grand.Domain.Common;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Common;
namespace Grand.Web.Admin.Services
{
- public partial class AddressAttributeViewModelService : IAddressAttributeViewModelService
+ public class AddressAttributeViewModelService : IAddressAttributeViewModelService
{
private readonly IAddressAttributeService _addressAttributeService;
private readonly ITranslationService _translationService;
@@ -31,7 +31,7 @@ namespace Grand.Web.Admin.Services
var attributeModel = x.ToModel();
attributeModel.AttributeControlTypeName = x.AttributeControlType.GetTranslationEnum(_translationService, _workContext);
return attributeModel;
- }), addressAttributes.Count());
+ }), addressAttributes.Count);
}
public virtual AddressAttributeModel PrepareAddressAttributeModel()
@@ -61,13 +61,14 @@ namespace Grand.Web.Admin.Services
public virtual async Task<(IEnumerable<AddressAttributeValueModel> addressAttributeValues, int totalCount)> PrepareAddressAttributeValues(string addressAttributeId)
{
var values = (await _addressAttributeService.GetAddressAttributeById(addressAttributeId)).AddressAttributeValues;
- return (values.Select(x => x.ToModel()), values.Count());
+ return (values.Select(x => x.ToModel()), values.Count);
}
public virtual AddressAttributeValueModel PrepareAddressAttributeValueModel(string addressAttributeId)
{
- var model = new AddressAttributeValueModel();
- model.AddressAttributeId = addressAttributeId;
+ var model = new AddressAttributeValueModel {
+ AddressAttributeId = addressAttributeId
+ };
return model;
}
diff --git a/src/Web/Grand.Web.Admin/Services/AffiliateViewModelService.cs b/src/Web/Grand.Web.Admin/Services/AffiliateViewModelService.cs
index 03c200046..ca2486429 100644
--- a/src/Web/Grand.Web.Admin/Services/AffiliateViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/AffiliateViewModelService.cs
@@ -10,14 +10,14 @@ using Grand.Domain.Payments;
using Grand.Domain.Seo;
using Grand.Domain.Shipping;
using Grand.Infrastructure;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Affiliates;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Services
{
- public partial class AffiliateViewModelService : IAffiliateViewModelService
+ public class AffiliateViewModelService : IAffiliateViewModelService
{
private readonly IWorkContext _workContext;
private readonly ICountryService _countryService;
@@ -95,13 +95,13 @@ namespace Grand.Web.Admin.Services
//address
model.Address.AvailableCountries.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Address.SelectCountry"), Value = "" });
foreach (var c in await _countryService.GetAllCountries(showHidden: true))
- model.Address.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id.ToString(), Selected = (affiliate != null && c.Id == affiliate.Address.CountryId) });
+ model.Address.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id, Selected = affiliate != null && c.Id == affiliate.Address.CountryId });
- var states = !String.IsNullOrEmpty(model.Address.CountryId) ? (await _countryService.GetCountryById(model.Address.CountryId))?.StateProvinces : new List<StateProvince>();
+ var states = !string.IsNullOrEmpty(model.Address.CountryId) ? (await _countryService.GetCountryById(model.Address.CountryId))?.StateProvinces : new List<StateProvince>();
if (states.Count > 0)
{
foreach (var s in states)
- model.Address.AvailableStates.Add(new SelectListItem { Text = s.Name, Value = s.Id.ToString(), Selected = (affiliate != null && s.Id == affiliate.Address.StateProvinceId) });
+ model.Address.AvailableStates.Add(new SelectListItem { Text = s.Name, Value = s.Id, Selected = affiliate != null && s.Id == affiliate.Address.StateProvinceId });
}
}
}
@@ -124,10 +124,11 @@ namespace Grand.Web.Admin.Services
}
public virtual async Task<Affiliate> InsertAffiliateModel(AffiliateModel model)
{
- var affiliate = new Affiliate();
- affiliate.Active = model.Active;
- affiliate.AdminComment = model.AdminComment;
- affiliate.Name = model.Name;
+ var affiliate = new Affiliate {
+ Active = model.Active,
+ AdminComment = model.AdminComment,
+ Name = model.Name
+ };
//validate friendly URL name
var friendlyUrlName = await affiliate.ValidateFriendlyUrlName(_affiliateService, _seoSettings, model.FriendlyUrlName, model.Name);
affiliate.FriendlyUrlName = friendlyUrlName.ToLowerInvariant();
@@ -151,15 +152,15 @@ namespace Grand.Web.Admin.Services
}
public virtual async Task<(IEnumerable<AffiliateModel.AffiliatedOrderModel> affiliateOrderModels, int totalCount)> PrepareAffiliatedOrderList(Affiliate affiliate, AffiliatedOrderListModel model, int pageIndex, int pageSize)
{
- DateTime? startDateValue = (model.StartDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
+ DateTime? startDateValue = model.StartDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
- DateTime? endDateValue = (model.EndDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
+ DateTime? endDateValue = model.EndDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
int? orderStatus = model.OrderStatusId > 0 ? model.OrderStatusId : null;
- PaymentStatus? paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)(model.PaymentStatusId) : null;
- ShippingStatus? shippingStatus = model.ShippingStatusId > 0 ? (ShippingStatus?)(model.ShippingStatusId) : null;
+ PaymentStatus? paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)model.PaymentStatusId : null;
+ ShippingStatus? shippingStatus = model.ShippingStatusId > 0 ? (ShippingStatus?)model.ShippingStatusId : null;
var orders = await _orderService.SearchOrders(
createdFromUtc: startDateValue,
diff --git a/src/Web/Grand.Web.Admin/Services/BlogViewModelService.cs b/src/Web/Grand.Web.Admin/Services/BlogViewModelService.cs
index f1e685417..cfa10f573 100644
--- a/src/Web/Grand.Web.Admin/Services/BlogViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/BlogViewModelService.cs
@@ -14,6 +14,7 @@ using Grand.Domain.Seo;
using Grand.Web.Common.Extensions;
using Grand.SharedKernel.Extensions;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Blogs;
using Grand.Web.Admin.Models.Catalog;
@@ -21,7 +22,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Services
{
- public partial class BlogViewModelService : IBlogViewModelService
+ public class BlogViewModelService : IBlogViewModelService
{
private readonly IBlogService _blogService;
private readonly IDateTimeService _dateTimeService;
@@ -92,7 +93,7 @@ namespace Grand.Web.Admin.Services
public virtual async Task<BlogPost> UpdateBlogPostModel(BlogPostModel model, BlogPost blogPost)
{
- string prevPictureId = blogPost.PictureId;
+ var prevPictureId = blogPost.PictureId;
blogPost = model.ToEntity(blogPost, _dateTimeService);
await _blogService.UpdateBlogPost(blogPost);
@@ -104,7 +105,7 @@ namespace Grand.Web.Admin.Services
await _slugService.SaveSlug(blogPost, seName, "");
//delete an old picture (if deleted or updated)
- if (!String.IsNullOrEmpty(prevPictureId) && prevPictureId != blogPost.PictureId)
+ if (!string.IsNullOrEmpty(prevPictureId) && prevPictureId != blogPost.PictureId)
{
var prevPicture = await _pictureService.GetPictureById(prevPictureId);
if (prevPicture != null)
@@ -156,8 +157,7 @@ namespace Grand.Web.Admin.Services
var blogproducts = await _blogService.GetProductsByBlogPostId(filterByBlogPostId);
foreach (var item in blogproducts.Skip((pageIndex - 1) * pageSize).Take(pageSize))
{
- productModels.Add(new BlogProductModel()
- {
+ productModels.Add(new BlogProductModel {
Id = item.Id,
DisplayOrder = item.DisplayOrder,
ProductId = item.ProductId,
@@ -169,19 +169,20 @@ namespace Grand.Web.Admin.Services
public virtual async Task<BlogProductModel.AddProductModel> PrepareBlogModelAddProductModel(string blogPostId)
{
- var model = new BlogProductModel.AddProductModel();
- model.BlogPostId = blogPostId;
+ var model = new BlogProductModel.AddProductModel {
+ BlogPostId = blogPostId
+ };
//stores
var storeId = _workContext.CurrentCustomer.StaffStoreId;
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var s in (await _storeService.GetAllStores()).Where(x => x.Id == storeId || string.IsNullOrWhiteSpace(storeId)))
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
//vendors
model.AvailableVendors.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var v in await _vendorService.GetAllVendors(showHidden: true))
- model.AvailableVendors.Add(new SelectListItem { Text = v.Name, Value = v.Id.ToString() });
+ model.AvailableVendors.Add(new SelectListItem { Text = v.Name, Value = v.Id });
//product types
model.AvailableProductTypes = ProductType.SimpleProduct.ToSelectList().ToList();
@@ -207,8 +208,7 @@ namespace Grand.Web.Admin.Services
{
if (products.FirstOrDefault(x => x.ProductId == id) == null)
{
- await _blogService.InsertBlogProduct(new BlogProduct()
- {
+ await _blogService.InsertBlogProduct(new BlogProduct {
BlogPostId = blogPostId,
ProductId = id,
DisplayOrder = 0
diff --git a/src/Web/Grand.Web.Admin/Services/BrandViewModelService.cs b/src/Web/Grand.Web.Admin/Services/BrandViewModelService.cs
index fa8f5bd3d..4a5630d31 100644
--- a/src/Web/Grand.Web.Admin/Services/BrandViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/BrandViewModelService.cs
@@ -12,6 +12,7 @@ using Grand.Domain.Discounts;
using Grand.Domain.Seo;
using Grand.Infrastructure;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Catalog;
using Grand.Web.Common.Extensions;
@@ -20,7 +21,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Services
{
- public partial class BrandViewModelService : IBrandViewModelService
+ public class BrandViewModelService : IBrandViewModelService
{
#region Fields
@@ -149,7 +150,7 @@ namespace Grand.Web.Admin.Services
public virtual async Task<Brand> UpdateBrandModel(Brand brand, BrandModel model)
{
- string prevPictureId = brand.PictureId;
+ var prevPictureId = brand.PictureId;
brand = model.ToEntity(brand);
brand.UpdatedOnUtc = DateTime.UtcNow;
brand.Locales = await model.Locales.ToTranslationProperty(brand, x => x.Name, _seoSettings, _slugService, _languageService);
@@ -178,7 +179,7 @@ namespace Grand.Web.Admin.Services
await _slugService.SaveSlug(brand, model.SeName, "");
//delete an old picture (if deleted or updated)
- if (!String.IsNullOrEmpty(prevPictureId) && prevPictureId != brand.PictureId)
+ if (!string.IsNullOrEmpty(prevPictureId) && prevPictureId != brand.PictureId)
{
var prevPicture = await _pictureService.GetPictureById(prevPictureId);
if (prevPicture != null)
diff --git a/src/Web/Grand.Web.Admin/Services/CampaignViewModelService.cs b/src/Web/Grand.Web.Admin/Services/CampaignViewModelService.cs
index 8608cda14..4ed76faa7 100644
--- a/src/Web/Grand.Web.Admin/Services/CampaignViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/CampaignViewModelService.cs
@@ -7,14 +7,14 @@ using Grand.Business.Core.Interfaces.Marketing.Customers;
using Grand.Business.Core.Interfaces.Marketing.Newsletters;
using Grand.Business.Core.Interfaces.Messages;
using Grand.Domain.Messages;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Messages;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Services
{
- public partial class CampaignViewModelService : ICampaignViewModelService
+ public class CampaignViewModelService : ICampaignViewModelService
{
private readonly ICampaignService _campaignService;
@@ -51,20 +51,6 @@ namespace Grand.Web.Admin.Services
_newsletterCategoryService = newsletterCategoryService;
}
- protected virtual string FormatTokens(string[] tokens)
- {
- var sb = new StringBuilder();
- for (int i = 0; i < tokens.Length; i++)
- {
- string token = tokens[i];
- sb.Append(token);
- if (i != tokens.Length - 1)
- sb.Append(", ");
- }
-
- return sb.ToString();
- }
-
protected virtual async Task PrepareStoresModel(CampaignModel model)
{
if (model == null)
@@ -76,7 +62,7 @@ namespace Grand.Web.Admin.Services
model.AvailableStores.Add(new SelectListItem
{
Text = store.Shortcut,
- Value = store.Id.ToString()
+ Value = store.Id
});
}
}
@@ -92,7 +78,7 @@ namespace Grand.Web.Admin.Services
model.AvailableLanguages.Add(new SelectListItem
{
Text = lang.Name,
- Value = lang.Id.ToString()
+ Value = lang.Id
});
}
}
@@ -101,24 +87,24 @@ namespace Grand.Web.Admin.Services
{
if (model == null)
throw new ArgumentNullException(nameof(model));
- model.AvailableCustomerTags = (await _customerTagService.GetAllCustomerTags()).Select(ct => new SelectListItem() { Text = ct.Name, Value = ct.Id, Selected = model.CustomerTags.Contains(ct.Id) }).ToList();
- model.CustomerTags = model.CustomerTags == null ? new List<string>() : model.CustomerTags;
+ model.AvailableCustomerTags = (await _customerTagService.GetAllCustomerTags()).Select(ct => new SelectListItem { Text = ct.Name, Value = ct.Id, Selected = model.CustomerTags.Contains(ct.Id) }).ToList();
+ model.CustomerTags ??= new List<string>();
}
protected virtual async Task PrepareCustomerGroupsModel(CampaignModel model)
{
if (model == null)
throw new ArgumentNullException(nameof(model));
- model.AvailableCustomerGroups = (await _groupService.GetAllCustomerGroups()).Select(ct => new SelectListItem() { Text = ct.Name, Value = ct.Id, Selected = model.CustomerGroups.Contains(ct.Id) }).ToList();
- model.CustomerGroups = model.CustomerGroups == null ? new List<string>() : model.CustomerGroups;
+ model.AvailableCustomerGroups = (await _groupService.GetAllCustomerGroups()).Select(ct => new SelectListItem { Text = ct.Name, Value = ct.Id, Selected = model.CustomerGroups.Contains(ct.Id) }).ToList();
+ model.CustomerGroups ??= new List<string>();
}
protected virtual async Task PrepareNewsletterCategoriesModel(CampaignModel model)
{
if (model == null)
throw new ArgumentNullException(nameof(model));
- model.AvailableNewsletterCategories = (await _newsletterCategoryService.GetAllNewsletterCategory()).Select(ct => new SelectListItem() { Text = ct.Name, Value = ct.Id, Selected = model.NewsletterCategories.Contains(ct.Id) }).ToList();
- model.NewsletterCategories = model.NewsletterCategories == null ? new List<string>() : model.NewsletterCategories;
+ model.AvailableNewsletterCategories = (await _newsletterCategoryService.GetAllNewsletterCategory()).Select(ct => new SelectListItem { Text = ct.Name, Value = ct.Id, Selected = model.NewsletterCategories.Contains(ct.Id) }).ToList();
+ model.NewsletterCategories ??= new List<string>();
}
protected virtual async Task PrepareEmailAccounts(CampaignModel model)
@@ -130,8 +116,9 @@ namespace Grand.Web.Admin.Services
public virtual async Task<CampaignModel> PrepareCampaignModel()
{
- var model = new CampaignModel();
- model.AllowedTokens = _messageTokenProvider.GetListOfCampaignAllowedTokens();
+ var model = new CampaignModel {
+ AllowedTokens = _messageTokenProvider.GetListOfCampaignAllowedTokens()
+ };
//stores
await PrepareStoresModel(model);
//languages
diff --git a/src/Web/Grand.Web.Admin/Services/CategoryViewModelService.cs b/src/Web/Grand.Web.Admin/Services/CategoryViewModelService.cs
index 18bf6d900..ec31c53a5 100644
--- a/src/Web/Grand.Web.Admin/Services/CategoryViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/CategoryViewModelService.cs
@@ -14,6 +14,7 @@ using Grand.Domain.Discounts;
using Grand.Domain.Seo;
using Grand.Infrastructure;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Catalog;
using Grand.Web.Common.Extensions;
@@ -22,7 +23,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Services
{
- public partial class CategoryViewModelService : ICategoryViewModelService
+ public class CategoryViewModelService : ICategoryViewModelService
{
private readonly ICategoryService _categoryService;
private readonly IProductCategoryService _productCategoryService;
@@ -128,7 +129,7 @@ namespace Grand.Web.Admin.Services
var model = new CategoryListModel();
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" });
foreach (var s in (await _storeService.GetAllStores()).Where(x => x.Id == storeId || string.IsNullOrWhiteSpace(storeId)))
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
return model;
}
@@ -215,7 +216,7 @@ namespace Grand.Web.Admin.Services
public virtual async Task<Category> UpdateCategoryModel(Category category, CategoryModel model)
{
- string prevPictureId = category.PictureId;
+ var prevPictureId = category.PictureId;
category = model.ToEntity(category);
category.UpdatedOnUtc = DateTime.UtcNow;
model.SeName = await category.ValidateSeName(model.SeName, category.Name, true, _seoSettings, _slugService, _languageService);
@@ -308,7 +309,7 @@ namespace Grand.Web.Admin.Services
if (product == null)
throw new ArgumentException("No product found with the specified id");
- var productCategory = product.ProductCategories.Where(x => x.Id == id).FirstOrDefault();
+ var productCategory = product.ProductCategories.FirstOrDefault(x => x.Id == id);
if (productCategory == null)
throw new ArgumentException("No product category mapping found with the specified id");
await _productCategoryService.DeleteProductCategory(productCategory, product.Id);
@@ -320,12 +321,12 @@ namespace Grand.Web.Admin.Services
//stores
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var s in (await _storeService.GetAllStores()).Where(x => x.Id == storeId || string.IsNullOrWhiteSpace(storeId)))
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
//vendors
model.AvailableVendors.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var v in await _vendorService.GetAllVendors(showHidden: true))
- model.AvailableVendors.Add(new SelectListItem { Text = v.Name, Value = v.Id.ToString() });
+ model.AvailableVendors.Add(new SelectListItem { Text = v.Name, Value = v.Id });
//product types
model.AvailableProductTypes = ProductType.SimpleProduct.ToSelectList().ToList();
@@ -335,18 +336,18 @@ namespace Grand.Web.Admin.Services
public virtual async Task InsertCategoryProductModel(CategoryModel.AddCategoryProductModel model)
{
- foreach (string id in model.SelectedProductIds)
+ foreach (var id in model.SelectedProductIds)
{
var product = await _productService.GetProductById(id);
if (product != null)
{
- if (product.ProductCategories.Where(x => x.CategoryId == model.CategoryId).Count() == 0)
+ if (!product.ProductCategories.Any(x => x.CategoryId == model.CategoryId))
{
await _productCategoryService.InsertProductCategory(
new ProductCategory {
CategoryId = model.CategoryId,
IsFeaturedProduct = false,
- DisplayOrder = 1,
+ DisplayOrder = 1
}, product.Id);
}
}
diff --git a/src/Web/Grand.Web.Admin/Services/CheckoutAttributeViewModelService.cs b/src/Web/Grand.Web.Admin/Services/CheckoutAttributeViewModelService.cs
index 18fe87405..aa37b6942 100644
--- a/src/Web/Grand.Web.Admin/Services/CheckoutAttributeViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/CheckoutAttributeViewModelService.cs
@@ -9,12 +9,12 @@ using Grand.Domain.Catalog;
using Grand.Domain.Common;
using Grand.Domain.Directory;
using Grand.Domain.Orders;
-using Grand.Web.Admin.Extensions;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Orders;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Http;
using Grand.Business.Core.Interfaces.Catalog.Directory;
+using Grand.Web.Admin.Extensions.Mapping;
namespace Grand.Web.Admin.Services
{
@@ -70,7 +70,7 @@ namespace Grand.Web.Admin.Services
var taxCategories = await _taxCategoryService.GetAllTaxCategories();
model.AvailableTaxCategories.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Configuration.Tax.Settings.TaxCategories.None"), Value = "" });
foreach (var tc in taxCategories)
- model.AvailableTaxCategories.Add(new SelectListItem { Text = tc.Name, Value = tc.Id.ToString(), Selected = checkoutAttribute != null && !excludeProperties && tc.Id == checkoutAttribute.TaxCategoryId });
+ model.AvailableTaxCategories.Add(new SelectListItem { Text = tc.Name, Value = tc.Id, Selected = checkoutAttribute != null && !excludeProperties && tc.Id == checkoutAttribute.TaxCategoryId });
}
public virtual async Task PrepareConditionAttributes(CheckoutAttributeModel model, CheckoutAttribute checkoutAttribute)
@@ -87,22 +87,19 @@ namespace Grand.Web.Admin.Services
var selectedAttribute = (await _checkoutAttributeParser.ParseCheckoutAttributes(checkoutAttribute.ConditionAttribute)).FirstOrDefault();
var selectedValues = await _checkoutAttributeParser.ParseCheckoutAttributeValues(checkoutAttribute.ConditionAttribute);
- model.ConditionModel = new ConditionModel()
- {
+ model.ConditionModel = new ConditionModel {
EnableCondition = checkoutAttribute.ConditionAttribute.Any(),
SelectedAttributeId = selectedAttribute != null ? selectedAttribute.Id : "",
ConditionAttributes = (await _checkoutAttributeService.GetAllCheckoutAttributes(ignoreAcl: false))
//ignore this attribute and non-combinable attributes
.Where(x => x.Id != checkoutAttribute.Id && x.CanBeUsedAsCondition())
.Select(x =>
- new AttributeConditionModel()
- {
+ new AttributeConditionModel {
Id = x.Id,
Name = x.Name,
AttributeControlType = x.AttributeControlTypeId,
Values = x.CheckoutAttributeValues
- .Select(v => new SelectListItem()
- {
+ .Select(v => new SelectListItem {
Text = v.Name,
Value = v.Id.ToString(),
Selected = selectedAttribute != null && selectedAttribute.Id == x.Id && selectedValues.Any(sv => sv.Id == v.Id)
@@ -128,7 +125,7 @@ namespace Grand.Web.Admin.Services
{
var selectedAttribute = model.ConditionModel.ConditionAttributes
.FirstOrDefault(x => x.Id == model.ConditionModel.SelectedAttributeId);
- var selectedValue = selectedAttribute != null ? selectedAttribute.SelectedValueId : null;
+ var selectedValue = selectedAttribute?.SelectedValueId;
if (!string.IsNullOrEmpty(selectedValue))
conditionAttributes = _checkoutAttributeParser.AddCheckoutAttribute(conditionAttributes, attribute, selectedValue).ToList();
else
@@ -139,7 +136,7 @@ namespace Grand.Web.Admin.Services
{
var selectedAttribute = model.ConditionModel.ConditionAttributes
.FirstOrDefault(x => x.Id == model.ConditionModel.SelectedAttributeId);
- var selectedValues = selectedAttribute != null ? selectedAttribute.Values.Where(x => x.Selected).Select(x => x.Value) : null;
+ var selectedValues = selectedAttribute?.Values.Where(x => x.Selected).Select(x => x.Value);
if (selectedValues.Any())
foreach (var value in selectedValues)
conditionAttributes = _checkoutAttributeParser.AddCheckoutAttribute(conditionAttributes, attribute, value).ToList();
@@ -170,7 +167,7 @@ namespace Grand.Web.Admin.Services
return checkoutAttributes.Select((Func<CheckoutAttribute, CheckoutAttributeModel>)(x =>
{
var attributeModel = x.ToModel();
- attributeModel.AttributeControlTypeName = TranslateExtensions.GetTranslationEnum<AttributeControlType>(x.AttributeControlTypeId, (ITranslationService)_translationService, (IWorkContext)_workContext);
+ attributeModel.AttributeControlTypeName = x.AttributeControlTypeId.GetTranslationEnum(_translationService, _workContext);
return attributeModel;
}));
}
@@ -182,12 +179,12 @@ namespace Grand.Web.Admin.Services
{
Id = x.Id,
CheckoutAttributeId = x.CheckoutAttributeId,
- Name = checkoutAttribute.AttributeControlTypeId != AttributeControlType.ColorSquares ? x.Name : string.Format("{0} - {1}", x.Name, x.ColorSquaresRgb),
+ Name = checkoutAttribute.AttributeControlTypeId != AttributeControlType.ColorSquares ? x.Name : $"{x.Name} - {x.ColorSquaresRgb}",
ColorSquaresRgb = x.ColorSquaresRgb,
PriceAdjustment = x.PriceAdjustment,
WeightAdjustment = x.WeightAdjustment,
IsPreSelected = x.IsPreSelected,
- DisplayOrder = x.DisplayOrder,
+ DisplayOrder = x.DisplayOrder
});
}
public virtual async Task<CheckoutAttributeModel> PrepareCheckoutAttributeModel()
@@ -203,14 +200,15 @@ namespace Grand.Web.Admin.Services
public virtual async Task<CheckoutAttributeValueModel> PrepareCheckoutAttributeValueModel(string checkoutAttributeId)
{
var checkoutAttribute = await _checkoutAttributeService.GetCheckoutAttributeById(checkoutAttributeId);
- var model = new CheckoutAttributeValueModel();
- model.CheckoutAttributeId = checkoutAttributeId;
- model.PrimaryStoreCurrencyCode = (await _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId)).CurrencyCode;
- model.BaseWeightIn = (await _measureService.GetMeasureWeightById(_measureSettings.BaseWeightId)).Name;
+ var model = new CheckoutAttributeValueModel {
+ CheckoutAttributeId = checkoutAttributeId,
+ PrimaryStoreCurrencyCode = (await _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId)).CurrencyCode,
+ BaseWeightIn = (await _measureService.GetMeasureWeightById(_measureSettings.BaseWeightId)).Name,
+ //color squares
+ DisplayColorSquaresRgb = checkoutAttribute.AttributeControlTypeId == AttributeControlType.ColorSquares,
+ ColorSquaresRgb = "#000000"
+ };
- //color squares
- model.DisplayColorSquaresRgb = checkoutAttribute.AttributeControlTypeId == AttributeControlType.ColorSquares;
- model.ColorSquaresRgb = "#000000";
return model;
}
public virtual async Task<CheckoutAttributeValueModel> PrepareCheckoutAttributeValueModel(CheckoutAttribute checkoutAttribute, CheckoutAttributeValue checkoutAttributeValue)
diff --git a/src/Web/Grand.Web.Admin/Services/CollectionViewModelService.cs b/src/Web/Grand.Web.Admin/Services/CollectionViewModelService.cs
index 7e8f79f5f..071d571ed 100644
--- a/src/Web/Grand.Web.Admin/Services/CollectionViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/CollectionViewModelService.cs
@@ -14,6 +14,7 @@ using Grand.Domain.Discounts;
using Grand.Domain.Seo;
using Grand.Infrastructure;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Catalog;
using Grand.Web.Common.Extensions;
@@ -22,7 +23,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Services
{
- public partial class CollectionViewModelService : ICollectionViewModelService
+ public class CollectionViewModelService : ICollectionViewModelService
{
#region Fields
@@ -163,7 +164,7 @@ namespace Grand.Web.Admin.Services
public virtual async Task<Collection> UpdateCollectionModel(Collection collection, CollectionModel model)
{
- string prevPictureId = collection.PictureId;
+ var prevPictureId = collection.PictureId;
collection = model.ToEntity(collection);
collection.UpdatedOnUtc = DateTime.UtcNow;
collection.Locales = await model.Locales.ToTranslationProperty(collection, x => x.Name, _seoSettings, _slugService, _languageService);
@@ -192,7 +193,7 @@ namespace Grand.Web.Admin.Services
await _slugService.SaveSlug(collection, model.SeName, "");
//delete an old picture (if deleted or updated)
- if (!String.IsNullOrEmpty(prevPictureId) && prevPictureId != collection.PictureId)
+ if (!string.IsNullOrEmpty(prevPictureId) && prevPictureId != collection.PictureId)
{
var prevPicture = await _pictureService.GetPictureById(prevPictureId);
if (prevPicture != null)
@@ -224,17 +225,17 @@ namespace Grand.Web.Admin.Services
//collections
model.AvailableCollections.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var m in await _collectionService.GetAllCollections(showHidden: true))
- model.AvailableCollections.Add(new SelectListItem { Text = m.Name, Value = m.Id.ToString() });
+ model.AvailableCollections.Add(new SelectListItem { Text = m.Name, Value = m.Id });
//stores
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var s in (await _storeService.GetAllStores()).Where(x => x.Id == storeId || string.IsNullOrWhiteSpace(storeId)))
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
//vendors
model.AvailableVendors.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var v in await _vendorService.GetAllVendors(showHidden: true))
- model.AvailableVendors.Add(new SelectListItem { Text = v.Name, Value = v.Id.ToString() });
+ model.AvailableVendors.Add(new SelectListItem { Text = v.Name, Value = v.Id });
//product types
model.AvailableProductTypes = ProductType.SimpleProduct.ToSelectList(_translationService, _workContext, false).ToList();
@@ -272,7 +273,7 @@ namespace Grand.Web.Admin.Services
if (product == null)
throw new ArgumentException("No product found with the specified id");
- var productCollection = product.ProductCollections.Where(x => x.Id == model.Id).FirstOrDefault();
+ var productCollection = product.ProductCollections.FirstOrDefault(x => x.Id == model.Id);
if (productCollection == null)
throw new ArgumentException("No product collection mapping found with the specified id");
@@ -287,7 +288,7 @@ namespace Grand.Web.Admin.Services
if (product == null)
throw new ArgumentException("No product found with the specified id");
- var productCollection = product.ProductCollections.Where(x => x.Id == id).FirstOrDefault();
+ var productCollection = product.ProductCollections.FirstOrDefault(x => x.Id == id);
if (productCollection == null)
throw new ArgumentException("No product collection mapping found with the specified id");
@@ -296,19 +297,18 @@ namespace Grand.Web.Admin.Services
}
public virtual async Task InsertCollectionProductModel(CollectionModel.AddCollectionProductModel model)
{
- foreach (string id in model.SelectedProductIds)
+ foreach (var id in model.SelectedProductIds)
{
var product = await _productService.GetProductById(id);
if (product != null)
{
- var existingProductcollections = product.ProductCollections;
- if (product.ProductCollections.Where(x => x.CollectionId == model.CollectionId).Count() == 0)
+ if (!product.ProductCollections.Any(x => x.CollectionId == model.CollectionId))
{
await _productCollectionService.InsertProductCollection(
new ProductCollection {
CollectionId = model.CollectionId,
IsFeaturedProduct = false,
- DisplayOrder = 1,
+ DisplayOrder = 1
}, product.Id);
}
}
diff --git a/src/Web/Grand.Web.Admin/Services/ContactAttributeViewModelService.cs b/src/Web/Grand.Web.Admin/Services/ContactAttributeViewModelService.cs
index 8a13ea9d6..df54ec6e7 100644
--- a/src/Web/Grand.Web.Admin/Services/ContactAttributeViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/ContactAttributeViewModelService.cs
@@ -6,7 +6,7 @@ using Grand.Infrastructure;
using Grand.Domain.Catalog;
using Grand.Domain.Common;
using Grand.Domain.Messages;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Messages;
using Microsoft.AspNetCore.Mvc.Rendering;
@@ -14,7 +14,7 @@ using Microsoft.AspNetCore.Http;
namespace Grand.Web.Admin.Services
{
- public partial class ContactAttributeViewModelService : IContactAttributeViewModelService
+ public class ContactAttributeViewModelService : IContactAttributeViewModelService
{
private readonly IContactAttributeService _contactAttributeService;
@@ -58,7 +58,7 @@ namespace Grand.Web.Admin.Services
{
var selectedAttribute = model.ConditionModel.ConditionAttributes
.FirstOrDefault(x => x.Id == model.ConditionModel.SelectedAttributeId);
- var selectedValue = selectedAttribute != null ? selectedAttribute.SelectedValueId : null;
+ var selectedValue = selectedAttribute?.SelectedValueId;
if (!string.IsNullOrEmpty(selectedValue))
customattributes = _contactAttributeParser.AddContactAttribute(customattributes, attribute, selectedValue).ToList();
else
@@ -117,22 +117,19 @@ namespace Grand.Web.Admin.Services
var selectedAttribute = (await _contactAttributeParser.ParseContactAttributes(contactAttribute.ConditionAttribute)).FirstOrDefault();
var selectedValues = await _contactAttributeParser.ParseContactAttributeValues(contactAttribute.ConditionAttribute);
- model.ConditionModel = new ConditionModel()
- {
+ model.ConditionModel = new ConditionModel {
EnableCondition = contactAttribute.ConditionAttribute.Any(),
SelectedAttributeId = selectedAttribute != null ? selectedAttribute.Id : "",
ConditionAttributes = (await _contactAttributeService.GetAllContactAttributes(_workContext.CurrentCustomer.StaffStoreId, ignoreAcl: true))
//ignore this attribute and non-combinable attributes
.Where(x => x.Id != contactAttribute.Id && x.CanBeUsedAsCondition())
.Select(x =>
- new AttributeConditionModel()
- {
+ new AttributeConditionModel {
Id = x.Id,
Name = x.Name,
AttributeControlType = x.AttributeControlType,
Values = x.ContactAttributeValues
- .Select(v => new SelectListItem()
- {
+ .Select(v => new SelectListItem {
Text = v.Name,
Value = v.Id.ToString(),
Selected = selectedAttribute != null && selectedAttribute.Id == x.Id && selectedValues.Any(sv => sv.Id == v.Id)
@@ -167,12 +164,13 @@ namespace Grand.Web.Admin.Services
public virtual ContactAttributeValueModel PrepareContactAttributeValueModel(ContactAttribute contactAttribute)
{
- var model = new ContactAttributeValueModel();
- model.ContactAttributeId = contactAttribute.Id;
+ var model = new ContactAttributeValueModel {
+ ContactAttributeId = contactAttribute.Id,
+ //color squares
+ DisplayColorSquaresRgb = contactAttribute.AttributeControlType == AttributeControlType.ColorSquares,
+ ColorSquaresRgb = "#000000"
+ };
- //color squares
- model.DisplayColorSquaresRgb = contactAttribute.AttributeControlType == AttributeControlType.ColorSquares;
- model.ColorSquaresRgb = "#000000";
return model;
}
public virtual ContactAttributeValueModel PrepareContactAttributeValueModel(ContactAttribute contactAttribute, ContactAttributeValue contactAttributeValue)
diff --git a/src/Web/Grand.Web.Admin/Services/ContactFormViewModelService.cs b/src/Web/Grand.Web.Admin/Services/ContactFormViewModelService.cs
index 458dfe525..8b0fbb549 100644
--- a/src/Web/Grand.Web.Admin/Services/ContactFormViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/ContactFormViewModelService.cs
@@ -5,14 +5,14 @@ using Grand.Business.Core.Interfaces.Marketing.Contacts;
using Grand.Business.Core.Interfaces.Messages;
using Grand.Infrastructure;
using Grand.Domain.Messages;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Messages;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Services
{
- public partial class ContactFormViewModelService : IContactFormViewModelService
+ public class ContactFormViewModelService : IContactFormViewModelService
{
private readonly IContactUsService _contactUsService;
private readonly IDateTimeService _dateTimeService;
@@ -42,20 +42,20 @@ namespace Grand.Web.Admin.Services
//stores
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" });
foreach (var s in await _storeService.GetAllStores())
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
return model;
}
public virtual async Task<(IEnumerable<ContactFormModel> contactFormModel, int totalCount)> PrepareContactFormListModel(ContactFormListModel model, int pageIndex, int pageSize)
{
- DateTime? startDateValue = (model.SearchStartDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.SearchStartDate.Value, _dateTimeService.CurrentTimeZone);
+ DateTime? startDateValue = model.SearchStartDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.SearchStartDate.Value, _dateTimeService.CurrentTimeZone);
- DateTime? endDateValue = (model.SearchEndDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.SearchEndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
+ DateTime? endDateValue = model.SearchEndDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.SearchEndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
- string vendorId = "";
+ var vendorId = "";
if (_workContext.CurrentVendor != null)
{
vendorId = _workContext.CurrentVendor.Id;
diff --git a/src/Web/Grand.Web.Admin/Services/CountryViewModelService.cs b/src/Web/Grand.Web.Admin/Services/CountryViewModelService.cs
index c92e9fd11..cb162ff5f 100644
--- a/src/Web/Grand.Web.Admin/Services/CountryViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/CountryViewModelService.cs
@@ -1,12 +1,12 @@
using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Domain.Directory;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Directory;
namespace Grand.Web.Admin.Services
{
- public partial class CountryViewModelService : ICountryViewModelService
+ public class CountryViewModelService : ICountryViewModelService
{
private readonly ICountryService _countryService;
@@ -17,11 +17,12 @@ namespace Grand.Web.Admin.Services
public virtual CountryModel PrepareCountryModel()
{
- var model = new CountryModel();
- //default values
- model.Published = true;
- model.AllowsBilling = true;
- model.AllowsShipping = true;
+ var model = new CountryModel {
+ //default values
+ Published = true,
+ AllowsBilling = true,
+ AllowsShipping = true
+ };
return model;
}
@@ -41,10 +42,11 @@ namespace Grand.Web.Admin.Services
public virtual StateProvinceModel PrepareStateProvinceModel(string countryId)
{
- var model = new StateProvinceModel();
- model.CountryId = countryId;
- //default value
- model.Published = true;
+ var model = new StateProvinceModel {
+ CountryId = countryId,
+ //default value
+ Published = true
+ };
return model;
}
diff --git a/src/Web/Grand.Web.Admin/Services/CourseViewModelService.cs b/src/Web/Grand.Web.Admin/Services/CourseViewModelService.cs
index 9b9d9868a..86d14f4d6 100644
--- a/src/Web/Grand.Web.Admin/Services/CourseViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/CourseViewModelService.cs
@@ -13,6 +13,7 @@ using Grand.Domain.Courses;
using Grand.Domain.Seo;
using Grand.Infrastructure;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Catalog;
using Grand.Web.Admin.Models.Courses;
@@ -23,7 +24,7 @@ using Microsoft.Extensions.DependencyInjection;
namespace Grand.Web.Admin.Services
{
- public partial class CourseViewModelService : ICourseViewModelService
+ public class CourseViewModelService : ICourseViewModelService
{
private readonly ICourseService _courseService;
private readonly ICourseLevelService _courseLevelService;
@@ -80,14 +81,14 @@ namespace Grand.Web.Admin.Services
{
if (model == null)
{
- model = new CourseModel();
- model.Published = true;
+ model = new CourseModel {
+ Published = true
+ };
}
foreach (var item in await _courseLevelService.GetAll())
{
- model.AvailableLevels.Add(new SelectListItem()
- {
+ model.AvailableLevels.Add(new SelectListItem {
Text = item.Name,
Value = item.Id
});
@@ -133,8 +134,8 @@ namespace Grand.Web.Admin.Services
public virtual async Task<Course> UpdateCourseModel(Course course, CourseModel model)
{
- string prevPictureId = course.PictureId;
- string prevProductId = course.ProductId;
+ var prevPictureId = course.PictureId;
+ var prevProductId = course.ProductId;
course = model.ToEntity(course);
course.UpdatedOnUtc = DateTime.UtcNow;
@@ -183,15 +184,15 @@ namespace Grand.Web.Admin.Services
{
if (model == null)
{
- model = new CourseLessonModel();
- model.Published = true;
+ model = new CourseLessonModel {
+ Published = true
+ };
}
model.CourseId = courseId;
foreach (var item in await _courseSubjectService.GetByCourseId(courseId))
{
- model.AvailableSubjects.Add(new SelectListItem()
- {
+ model.AvailableSubjects.Add(new SelectListItem {
Text = item.Name,
Value = item.Id
});
@@ -216,7 +217,7 @@ namespace Grand.Web.Admin.Services
var prevAttachmentId = lesson.AttachmentId;
var prevVideoFile = lesson.VideoFile;
- string prevPictureId = lesson.PictureId;
+ var prevPictureId = lesson.PictureId;
lesson = model.ToEntity(lesson);
await _courseLessonService.Update(lesson);
@@ -286,13 +287,13 @@ namespace Grand.Web.Admin.Services
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
var storeService = _serviceProvider.GetRequiredService<IStoreService>();
foreach (var s in await storeService.GetAllStores())
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
//vendors
model.AvailableVendors.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
var vendorService = _serviceProvider.GetRequiredService<IVendorService>();
foreach (var v in await vendorService.GetAllVendors(showHidden: true))
- model.AvailableVendors.Add(new SelectListItem { Text = v.Name, Value = v.Id.ToString() });
+ model.AvailableVendors.Add(new SelectListItem { Text = v.Name, Value = v.Id });
//product types
model.AvailableProductTypes = ProductType.SimpleProduct.ToSelectList().ToList();
diff --git a/src/Web/Grand.Web.Admin/Services/CurrencyViewModelService.cs b/src/Web/Grand.Web.Admin/Services/CurrencyViewModelService.cs
index e38032b73..77d7afaf8 100644
--- a/src/Web/Grand.Web.Admin/Services/CurrencyViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/CurrencyViewModelService.cs
@@ -1,12 +1,12 @@
using Grand.Domain.Directory;
using Grand.Business.Core.Interfaces.Common.Directory;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Directory;
namespace Grand.Web.Admin.Services
{
- public partial class CurrencyViewModelService : ICurrencyViewModelService
+ public class CurrencyViewModelService : ICurrencyViewModelService
{
#region Fields
@@ -25,10 +25,11 @@ namespace Grand.Web.Admin.Services
public virtual CurrencyModel PrepareCurrencyModel()
{
- var model = new CurrencyModel();
- //default values
- model.Published = true;
- model.Rate = 1;
+ var model = new CurrencyModel {
+ //default values
+ Published = true,
+ Rate = 1
+ };
return model;
}
diff --git a/src/Web/Grand.Web.Admin/Services/CustomerAttributeViewModelService.cs b/src/Web/Grand.Web.Admin/Services/CustomerAttributeViewModelService.cs
index ea63749d3..a168b6105 100644
--- a/src/Web/Grand.Web.Admin/Services/CustomerAttributeViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/CustomerAttributeViewModelService.cs
@@ -2,14 +2,14 @@
using Grand.Domain.Customers;
using Grand.Business.Core.Interfaces.Customers;
using Grand.Business.Core.Interfaces.Common.Localization;
-using Grand.Web.Admin.Extensions;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Customers;
using Grand.Business.Core.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
namespace Grand.Web.Admin.Services
{
- public partial class CustomerAttributeViewModelService : ICustomerAttributeViewModelService
+ public class CustomerAttributeViewModelService : ICustomerAttributeViewModelService
{
private readonly ICustomerAttributeService _customerAttributeService;
private readonly ITranslationService _translationService;
@@ -60,15 +60,16 @@ namespace Grand.Web.Admin.Services
return customerAttributes.Select((Func<CustomerAttribute, CustomerAttributeModel>)(x =>
{
var attributeModel = x.ToModel();
- attributeModel.AttributeControlTypeName = TranslateExtensions.GetTranslationEnum<Domain.Catalog.AttributeControlType>(x.AttributeControlTypeId, (ITranslationService)_translationService, (IWorkContext)_workContext);
+ attributeModel.AttributeControlTypeName = x.AttributeControlTypeId.GetTranslationEnum(_translationService, _workContext);
return attributeModel;
}));
}
public virtual CustomerAttributeValueModel PrepareCustomerAttributeValueModel(string customerAttributeId)
{
- var model = new CustomerAttributeValueModel();
- model.CustomerAttributeId = customerAttributeId;
+ var model = new CustomerAttributeValueModel {
+ CustomerAttributeId = customerAttributeId
+ };
return model;
}
@@ -87,7 +88,7 @@ namespace Grand.Web.Admin.Services
CustomerAttributeId = x.CustomerAttributeId,
Name = x.Name,
IsPreSelected = x.IsPreSelected,
- DisplayOrder = x.DisplayOrder,
+ DisplayOrder = x.DisplayOrder
});
}
diff --git a/src/Web/Grand.Web.Admin/Services/CustomerGroupViewModelService.cs b/src/Web/Grand.Web.Admin/Services/CustomerGroupViewModelService.cs
index 6c5ec158e..815db1148 100644
--- a/src/Web/Grand.Web.Admin/Services/CustomerGroupViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/CustomerGroupViewModelService.cs
@@ -8,6 +8,7 @@ using Grand.Domain.Catalog;
using Grand.Domain.Customers;
using Grand.Infrastructure;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Catalog;
using Grand.Web.Admin.Models.Customers;
@@ -17,7 +18,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Services
{
- public partial class CustomerGroupViewModelService : ICustomerGroupViewModelService
+ public class CustomerGroupViewModelService : ICustomerGroupViewModelService
{
private readonly IGroupService _groupService;
private readonly ICustomerGroupProductService _customerGroupProductService;
@@ -66,9 +67,10 @@ namespace Grand.Web.Admin.Services
public virtual CustomerGroupModel PrepareCustomerGroupModel()
{
- var model = new CustomerGroupModel();
- //default values
- model.Active = true;
+ var model = new CustomerGroupModel {
+ //default values
+ Active = true
+ };
return model;
}
@@ -121,18 +123,19 @@ namespace Grand.Web.Admin.Services
}
public virtual async Task<CustomerGroupProductModel.AddProductModel> PrepareProductModel(string customerGroupId)
{
- var model = new CustomerGroupProductModel.AddProductModel();
- model.CustomerGroupId = customerGroupId;
+ var model = new CustomerGroupProductModel.AddProductModel {
+ CustomerGroupId = customerGroupId
+ };
//stores
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var s in await _storeService.GetAllStores())
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
//vendors
model.AvailableVendors.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var v in await _vendorService.GetAllVendors(showHidden: true))
- model.AvailableVendors.Add(new SelectListItem { Text = v.Name, Value = v.Id.ToString() });
+ model.AvailableVendors.Add(new SelectListItem { Text = v.Name, Value = v.Id });
//product types
model.AvailableProductTypes = ProductType.SimpleProduct.ToSelectList().ToList();
@@ -147,7 +150,7 @@ namespace Grand.Web.Admin.Services
}
public virtual async Task InsertProductModel(CustomerGroupProductModel.AddProductModel model)
{
- foreach (string id in model.SelectedProductIds)
+ foreach (var id in model.SelectedProductIds)
{
var product = await _productService.GetProductById(id);
if (product != null)
@@ -155,10 +158,11 @@ namespace Grand.Web.Admin.Services
var customerGroupProduct = await _customerGroupProductService.GetCustomerGroupProduct(model.CustomerGroupId, id);
if (customerGroupProduct == null)
{
- customerGroupProduct = new CustomerGroupProduct();
- customerGroupProduct.CustomerGroupId = model.CustomerGroupId;
- customerGroupProduct.ProductId = id;
- customerGroupProduct.DisplayOrder = 0;
+ customerGroupProduct = new CustomerGroupProduct {
+ CustomerGroupId = model.CustomerGroupId,
+ ProductId = id,
+ DisplayOrder = 0
+ };
await _customerGroupProductService.InsertCustomerGroupProduct(customerGroupProduct);
}
}
diff --git a/src/Web/Grand.Web.Admin/Services/CustomerReportViewModelService.cs b/src/Web/Grand.Web.Admin/Services/CustomerReportViewModelService.cs
index b52ab8f33..4be712bf2 100644
--- a/src/Web/Grand.Web.Admin/Services/CustomerReportViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/CustomerReportViewModelService.cs
@@ -47,7 +47,7 @@ namespace Grand.Web.Admin.Services
};
var status = await _orderStatusService.GetAll();
- model.BestCustomersByNumberOfOrders.AvailableOrderStatuses = status.Select(x => new SelectListItem() { Value = x.StatusId.ToString(), Text = x.Name }).ToList();
+ model.BestCustomersByNumberOfOrders.AvailableOrderStatuses = status.Select(x => new SelectListItem { Value = x.StatusId.ToString(), Text = x.Name }).ToList();
model.BestCustomersByNumberOfOrders.AvailableOrderStatuses.Insert(0, new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" });
model.BestCustomersByNumberOfOrders.AvailablePaymentStatuses = PaymentStatus.Pending.ToSelectList(_translationService, _workContext, false).ToList();
@@ -57,7 +57,7 @@ namespace Grand.Web.Admin.Services
//customers by order total
model.BestCustomersByOrderTotal = new BestCustomersReportModel {
- AvailableOrderStatuses = status.Select(x => new SelectListItem() { Value = x.StatusId.ToString(), Text = x.Name }).ToList()
+ AvailableOrderStatuses = status.Select(x => new SelectListItem { Value = x.StatusId.ToString(), Text = x.Name }).ToList()
};
model.BestCustomersByOrderTotal.AvailableOrderStatuses.Insert(0, new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" });
model.BestCustomersByOrderTotal.AvailablePaymentStatuses = PaymentStatus.Pending.ToSelectList(_translationService, _workContext, false).ToList();
@@ -100,15 +100,15 @@ namespace Grand.Web.Admin.Services
public virtual async Task<(IEnumerable<BestCustomerReportLineModel> bestCustomerReportLineModels, int totalCount)> PrepareBestCustomerReportLineModel(BestCustomersReportModel model, int orderBy, int pageIndex, int pageSize)
{
- DateTime? startDateValue = (model.StartDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
+ DateTime? startDateValue = model.StartDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
- DateTime? endDateValue = (model.EndDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
+ DateTime? endDateValue = model.EndDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
int? orderStatus = model.OrderStatusId > 0 ? model.OrderStatusId : null;
- PaymentStatus? paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)(model.PaymentStatusId) : null;
- ShippingStatus? shippingStatus = model.ShippingStatusId > 0 ? (ShippingStatus?)(model.ShippingStatusId) : null;
+ PaymentStatus? paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)model.PaymentStatusId : null;
+ ShippingStatus? shippingStatus = model.ShippingStatusId > 0 ? (ShippingStatus?)model.ShippingStatusId : null;
var items = _customerReportService.GetBestCustomersReport(model.StoreId, startDateValue, endDateValue,
orderStatus, paymentStatus, shippingStatus, 2, pageIndex - 1, pageSize);
@@ -119,7 +119,7 @@ namespace Grand.Web.Admin.Services
var m = new BestCustomerReportLineModel {
CustomerId = x.CustomerId,
OrderTotal = _priceFormatter.FormatPrice(x.OrderTotal, false),
- OrderCount = x.OrderCount,
+ OrderCount = x.OrderCount
};
var customer = await _customerService.GetCustomerById(x.CustomerId);
if (customer != null)
diff --git a/src/Web/Grand.Web.Admin/Services/CustomerTagViewModelService.cs b/src/Web/Grand.Web.Admin/Services/CustomerTagViewModelService.cs
index 8cc8f8168..9da5e6919 100644
--- a/src/Web/Grand.Web.Admin/Services/CustomerTagViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/CustomerTagViewModelService.cs
@@ -9,6 +9,7 @@ using Grand.Domain.Catalog;
using Grand.Domain.Customers;
using Grand.Infrastructure;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Catalog;
using Grand.Web.Admin.Models.Customers;
@@ -18,7 +19,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Services
{
- public partial class CustomerTagViewModelService : ICustomerTagViewModelService
+ public class CustomerTagViewModelService : ICustomerTagViewModelService
{
private readonly ITranslationService _translationService;
private readonly ICustomerActivityService _customerActivityService;
@@ -57,7 +58,7 @@ namespace Grand.Web.Admin.Services
return new CustomerModel
{
Id = customer.Id,
- Email = !string.IsNullOrEmpty(customer.Email) ? customer.Email : _translationService.GetResource("Admin.Customers.Guest"),
+ Email = !string.IsNullOrEmpty(customer.Email) ? customer.Email : _translationService.GetResource("Admin.Customers.Guest")
};
}
public virtual CustomerTagModel PrepareCustomerTagModel()
@@ -100,18 +101,19 @@ namespace Grand.Web.Admin.Services
}
public virtual async Task<CustomerTagProductModel.AddProductModel> PrepareProductModel(string customerTagId)
{
- var model = new CustomerTagProductModel.AddProductModel();
- model.CustomerTagId = customerTagId;
+ var model = new CustomerTagProductModel.AddProductModel {
+ CustomerTagId = customerTagId
+ };
//stores
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var s in await _storeService.GetAllStores())
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
//vendors
model.AvailableVendors.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var v in await _vendorService.GetAllVendors(showHidden: true))
- model.AvailableVendors.Add(new SelectListItem { Text = v.Name, Value = v.Id.ToString() });
+ model.AvailableVendors.Add(new SelectListItem { Text = v.Name, Value = v.Id });
//product types
model.AvailableProductTypes = ProductType.SimpleProduct.ToSelectList().ToList();
@@ -125,7 +127,7 @@ namespace Grand.Web.Admin.Services
}
public virtual async Task InsertProductModel(CustomerTagProductModel.AddProductModel model)
{
- foreach (string id in model.SelectedProductIds)
+ foreach (var id in model.SelectedProductIds)
{
var product = await _productService.GetProductById(id);
if (product != null)
@@ -133,10 +135,11 @@ namespace Grand.Web.Admin.Services
var customerTagProduct = await _customerTagService.GetCustomerTagProduct(model.CustomerTagId, id);
if (customerTagProduct == null)
{
- customerTagProduct = new CustomerTagProduct();
- customerTagProduct.CustomerTagId = model.CustomerTagId;
- customerTagProduct.ProductId = id;
- customerTagProduct.DisplayOrder = 0;
+ customerTagProduct = new CustomerTagProduct {
+ CustomerTagId = model.CustomerTagId,
+ ProductId = id,
+ DisplayOrder = 0
+ };
await _customerTagService.InsertCustomerTagProduct(customerTagProduct);
}
}
diff --git a/src/Web/Grand.Web.Admin/Services/CustomerViewModelService.cs b/src/Web/Grand.Web.Admin/Services/CustomerViewModelService.cs
index 1d77ae194..dbfbb7ac9 100644
--- a/src/Web/Grand.Web.Admin/Services/CustomerViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/CustomerViewModelService.cs
@@ -25,6 +25,7 @@ using Grand.Domain.Tax;
using Grand.Infrastructure;
using Grand.SharedKernel;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Catalog;
using Grand.Web.Admin.Models.Common;
@@ -39,7 +40,7 @@ using System.Net;
namespace Grand.Web.Admin.Services
{
- public partial class CustomerViewModelService : ICustomerViewModelService
+ public class CustomerViewModelService : ICustomerViewModelService
{
private readonly ICustomerService _customerService;
private readonly IGroupService _groupService;
@@ -142,11 +143,11 @@ namespace Grand.Web.Admin.Services
protected virtual string[] ParseCustomerTags(string customerTags)
{
var result = new List<string>();
- if (!String.IsNullOrWhiteSpace(customerTags))
+ if (!string.IsNullOrWhiteSpace(customerTags))
{
- string[] values = customerTags.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
- foreach (string val1 in values)
- if (!String.IsNullOrEmpty(val1.Trim()))
+ var values = customerTags.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
+ foreach (var val1 in values)
+ if (!string.IsNullOrEmpty(val1.Trim()))
result.Add(val1.Trim());
}
return result.ToArray();
@@ -162,9 +163,9 @@ namespace Grand.Web.Admin.Services
var customerTagsToRemove = new List<CustomerTag>();
foreach (var existingCustomerTag in existingCustomerTags)
{
- bool found = false;
+ var found = false;
var existingCustomerTagName = await _customerTagService.GetCustomerTagById(existingCustomerTag);
- foreach (string newCustomerTag in customerTags)
+ foreach (var newCustomerTag in customerTags)
{
if (existingCustomerTagName.Name.Equals(newCustomerTag, StringComparison.OrdinalIgnoreCase))
{
@@ -179,14 +180,14 @@ namespace Grand.Web.Admin.Services
}
}
- foreach (string customerTagName in customerTags)
+ foreach (var customerTagName in customerTags)
{
CustomerTag customerTag;
var customerTag2 = await _customerTagService.GetCustomerTagByName(customerTagName);
if (customerTag2 == null)
{
customerTag = new CustomerTag {
- Name = customerTagName,
+ Name = customerTagName
};
await _customerTagService.InsertCustomerTag(customerTag);
}
@@ -204,7 +205,7 @@ namespace Grand.Web.Admin.Services
protected virtual string GetCustomerGroupsNames(IList<CustomerGroup> customerGroups, string separator = ",")
{
var sb = new StringBuilder();
- for (int i = 0; i < customerGroups.Count; i++)
+ for (var i = 0; i < customerGroups.Count; i++)
{
sb.Append(customerGroups[i].Name);
if (i != customerGroups.Count - 1)
@@ -252,7 +253,7 @@ namespace Grand.Web.Admin.Services
CustomerGroupNames = GetCustomerGroupsNames(await _groupService.GetAllByIds(customer.Groups.ToArray())),
Active = customer.Active,
CreatedOn = _dateTimeService.ConvertToUserTime(customer.CreatedOnUtc, DateTimeKind.Utc),
- LastActivityDate = _dateTimeService.ConvertToUserTime(customer.LastActivityDateUtc, DateTimeKind.Utc),
+ LastActivityDate = _dateTimeService.ConvertToUserTime(customer.LastActivityDateUtc, DateTimeKind.Utc)
};
}
@@ -290,7 +291,7 @@ namespace Grand.Web.Admin.Services
{
model.AvailableStores.Add(new SelectListItem {
Text = store.Shortcut,
- Value = store.Id.ToString()
+ Value = store.Id
});
}
}
@@ -304,7 +305,7 @@ namespace Grand.Web.Admin.Services
Id = attribute.Id,
Name = attribute.Name,
IsRequired = attribute.IsRequired,
- AttributeControlType = attribute.AttributeControlTypeId,
+ AttributeControlType = attribute.AttributeControlTypeId
};
if (attribute.ShouldHaveValues())
@@ -390,9 +391,9 @@ namespace Grand.Web.Admin.Services
CompanyEnabled = _customerSettings.CompanyEnabled,
PhoneEnabled = _customerSettings.PhoneEnabled,
ZipPostalCodeEnabled = _customerSettings.ZipPostalCodeEnabled,
- AvailableCustomerGroups = customerGroups.Select(cr => new SelectListItem() { Text = cr.Name, Value = cr.Id.ToString(), Selected = (cr.Id == registered.Id) }).ToList(),
- AvailableCustomerTags = (await _customerTagService.GetAllCustomerTags()).Select(ct => new SelectListItem() { Text = ct.Name, Value = ct.Id.ToString() }).ToList(),
- SearchCustomerGroupIds = new List<string> { customerGroups.FirstOrDefault(x => x.Id == registered.Id).Id },
+ AvailableCustomerGroups = customerGroups.Select(cr => new SelectListItem { Text = cr.Name, Value = cr.Id.ToString(), Selected = cr.Id == registered.Id }).ToList(),
+ AvailableCustomerTags = (await _customerTagService.GetAllCustomerTags()).Select(ct => new SelectListItem { Text = ct.Name, Value = ct.Id.ToString() }).ToList(),
+ SearchCustomerGroupIds = new List<string> { customerGroups.FirstOrDefault(x => x.Id == registered.Id)?.Id }
};
return model;
}
@@ -474,14 +475,14 @@ namespace Grand.Web.Admin.Services
model.CustomerGroups = customer.Groups.ToArray();
//newsletter subscriptions
- if (!String.IsNullOrEmpty(customer.Email))
+ if (!string.IsNullOrEmpty(customer.Email))
{
var newsletterSubscriptionStoreIds = new List<string>();
foreach (var store in allStores)
{
var newsletterSubscription = await _newsLetterSubscriptionService
.GetNewsLetterSubscriptionByEmailAndStoreId(customer.Email, store.Id);
- if (newsletterSubscription != null && newsletterSubscription.Active)
+ if (newsletterSubscription is { Active: true })
newsletterSubscriptionStoreIds.Add(store.Id);
}
model.SelectedNewsletterSubscriptionStoreIds = newsletterSubscriptionStoreIds.ToArray();
@@ -549,7 +550,7 @@ namespace Grand.Web.Admin.Services
{
model.AvailableCountries.Add(new SelectListItem {
Text = c.Name,
- Value = c.Id.ToString(),
+ Value = c.Id,
Selected = c.Id == model.CountryId
});
}
@@ -562,14 +563,14 @@ namespace Grand.Web.Admin.Services
if (states != null)
foreach (var s in states)
{
- model.AvailableStates.Add(new SelectListItem { Text = s.Name, Value = s.Id.ToString(), Selected = (s.Id == model.StateProvinceId) });
+ model.AvailableStates.Add(new SelectListItem { Text = s.Name, Value = s.Id, Selected = s.Id == model.StateProvinceId });
}
}
}
//newsletter subscriptions
model.AvailableNewsletterSubscriptionStores = allStores
- .Select(s => new StoreModel() { Id = s.Id, Name = s.Shortcut })
+ .Select(s => new StoreModel { Id = s.Id, Name = s.Shortcut })
.ToList();
@@ -585,8 +586,8 @@ namespace Grand.Web.Admin.Services
{
model.LoyaltyPointsAvailableStores.Add(new SelectListItem {
Text = store.Shortcut,
- Value = store.Id.ToString(),
- Selected = (store.Id == _workContext.CurrentStore.Id)
+ Value = store.Id,
+ Selected = store.Id == _workContext.CurrentStore.Id
});
}
@@ -634,7 +635,7 @@ namespace Grand.Web.Admin.Services
if (!isInGuestsGroup && !isInRegisteredGroup)
return "Add the customer to 'Guests' or 'Registered' customer group";
- if (await _groupService.IsSalesManager(_workContext.CurrentCustomer) && ((isInGuestsGroup && !isInRegisteredGroup) || customerGroups.Count != 1))
+ if (await _groupService.IsSalesManager(_workContext.CurrentCustomer) && (isInGuestsGroup || customerGroups.Count != 1))
return "Sales manager can assign role 'Registered' only";
if (!await _groupService.IsAdmin(_workContext.CurrentCustomer) && isAdminGroup)
@@ -669,7 +670,7 @@ namespace Grand.Web.Admin.Services
OwnerId = ownerId,
Attributes = model.Attributes,
CreatedOnUtc = DateTime.UtcNow,
- LastActivityDateUtc = DateTime.UtcNow,
+ LastActivityDateUtc = DateTime.UtcNow
};
//user fields
@@ -753,7 +754,7 @@ namespace Grand.Web.Admin.Services
//ensure that a customer with a vendor associated is not in "Administrators" role
//otherwise, he won't be have access to the other functionality in admin area
- if (await _groupService.IsAdmin(customer) && !String.IsNullOrEmpty(customer.VendorId))
+ if (await _groupService.IsAdmin(customer) && !string.IsNullOrEmpty(customer.VendorId))
{
customer.VendorId = "";
await _customerService.UpdateCustomerField(customer.Id, x => x.VendorId, customer.VendorId);
@@ -853,7 +854,7 @@ namespace Grand.Web.Admin.Services
await _userFieldService.SaveField(customer, SystemCustomerFieldNames.VatNumber, model.VatNumber);
//set VAT number status
- if (!String.IsNullOrEmpty(model.VatNumber))
+ if (!string.IsNullOrEmpty(model.VatNumber))
{
if (!model.VatNumber.Equals(prevVatNumber, StringComparison.OrdinalIgnoreCase))
{
@@ -1034,7 +1035,7 @@ namespace Grand.Web.Admin.Services
_ = _customerActivityService.InsertActivity("DeleteCustomer", customer.Id, _workContext.CurrentCustomer, "", _translationService.GetResource("ActivityLog.DeleteCustomer"), customer.Id);
}
- public virtual async Task DeleteSelected(IList<string> selectedIds)
+ public virtual async Task DeleteSelected(IEnumerable<string> selectedIds)
{
var customers = new List<Customer>();
customers.AddRange(await _customerService.GetCustomersByIds(selectedIds.ToArray()));
@@ -1056,9 +1057,8 @@ namespace Grand.Web.Admin.Services
var emailAccountSettings = _serviceProvider.GetRequiredService<EmailAccountSettings>();
var queuedEmailService = _serviceProvider.GetRequiredService<IQueuedEmailService>();
- var emailAccount = await emailAccountService.GetEmailAccountById(emailAccountSettings.DefaultEmailAccountId);
- if (emailAccount == null)
- emailAccount = (await emailAccountService.GetAllEmailAccounts()).FirstOrDefault();
+ var emailAccount = await emailAccountService.GetEmailAccountById(emailAccountSettings.DefaultEmailAccountId) ??
+ (await emailAccountService.GetAllEmailAccounts()).FirstOrDefault();
if (emailAccount == null)
throw new GrandException("Email account can't be loaded");
@@ -1072,8 +1072,8 @@ namespace Grand.Web.Admin.Services
Subject = model.Subject,
Body = model.Body,
CreatedOnUtc = DateTime.UtcNow,
- DontSendBeforeDateUtc = (model.SendImmediately || !model.DontSendBeforeDate.HasValue) ?
- null : (DateTime?)_dateTimeService.ConvertToUtcTime(model.DontSendBeforeDate.Value)
+ DontSendBeforeDateUtc = model.SendImmediately || !model.DontSendBeforeDate.HasValue ?
+ null : _dateTimeService.ConvertToUtcTime(model.DontSendBeforeDate.Value)
};
await queuedEmailService.InsertQueuedEmail(email);
_ = _customerActivityService.InsertActivity("CustomerAdmin.SendEmail", "", customer, "", _translationService.GetResource("ActivityLog.SendEmailfromAdminPanel"), model.Subject);
@@ -1112,19 +1112,19 @@ namespace Grand.Web.Admin.Services
{
var model = await x.ToModel(_countryService);
var addressHtmlSb = new StringBuilder("<div>");
- if (_addressSettings.CompanyEnabled && !String.IsNullOrEmpty(model.Company))
+ if (_addressSettings.CompanyEnabled && !string.IsNullOrEmpty(model.Company))
addressHtmlSb.AppendFormat("{0}<br />", WebUtility.HtmlEncode(model.Company));
- if (_addressSettings.StreetAddressEnabled && !String.IsNullOrEmpty(model.Address1))
+ if (_addressSettings.StreetAddressEnabled && !string.IsNullOrEmpty(model.Address1))
addressHtmlSb.AppendFormat("{0}<br />", WebUtility.HtmlEncode(model.Address1));
- if (_addressSettings.StreetAddress2Enabled && !String.IsNullOrEmpty(model.Address2))
+ if (_addressSettings.StreetAddress2Enabled && !string.IsNullOrEmpty(model.Address2))
addressHtmlSb.AppendFormat("{0}<br />", WebUtility.HtmlEncode(model.Address2));
- if (_addressSettings.CityEnabled && !String.IsNullOrEmpty(model.City))
+ if (_addressSettings.CityEnabled && !string.IsNullOrEmpty(model.City))
addressHtmlSb.AppendFormat("{0},", WebUtility.HtmlEncode(model.City));
- if (_addressSettings.StateProvinceEnabled && !String.IsNullOrEmpty(model.StateProvinceName))
+ if (_addressSettings.StateProvinceEnabled && !string.IsNullOrEmpty(model.StateProvinceName))
addressHtmlSb.AppendFormat("{0},", WebUtility.HtmlEncode(model.StateProvinceName));
- if (_addressSettings.ZipPostalCodeEnabled && !String.IsNullOrEmpty(model.ZipPostalCode))
+ if (_addressSettings.ZipPostalCodeEnabled && !string.IsNullOrEmpty(model.ZipPostalCode))
addressHtmlSb.AppendFormat("{0}<br />", WebUtility.HtmlEncode(model.ZipPostalCode));
- if (_addressSettings.CountryEnabled && !String.IsNullOrEmpty(model.CountryName))
+ if (_addressSettings.CountryEnabled && !string.IsNullOrEmpty(model.CountryName))
addressHtmlSb.AppendFormat("{0}", WebUtility.HtmlEncode(model.CountryName));
var customAttributesFormatted = await _addressAttributeParser.FormatAttributes(_workContext.WorkingLanguage, x.Attributes);
if (!string.IsNullOrEmpty(customAttributesFormatted))
@@ -1202,13 +1202,13 @@ namespace Grand.Web.Admin.Services
//countries
model.Address.AvailableCountries.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Address.SelectCountry"), Value = "" });
foreach (var c in await _countryService.GetAllCountries(showHidden: true))
- model.Address.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id.ToString(), Selected = (c.Id == model.Address.CountryId) });
+ model.Address.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id, Selected = c.Id == model.Address.CountryId });
//states
- var states = !String.IsNullOrEmpty(model.Address.CountryId) ? (await _countryService.GetCountryById(model.Address.CountryId))?.StateProvinces : new List<StateProvince>();
- if (states.Count > 0)
+ var states = !string.IsNullOrEmpty(model.Address.CountryId) ? (await _countryService.GetCountryById(model.Address.CountryId))?.StateProvinces : new List<StateProvince>();
+ if (states?.Count > 0)
{
foreach (var s in states)
- model.Address.AvailableStates.Add(new SelectListItem { Text = s.Name, Value = s.Id.ToString(), Selected = (s.Id == model.Address.StateProvinceId) });
+ model.Address.AvailableStates.Add(new SelectListItem { Text = s.Name, Value = s.Id, Selected = s.Id == model.Address.StateProvinceId });
}
//customer attribute services
@@ -1334,12 +1334,12 @@ namespace Grand.Web.Admin.Services
//stores
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var s in await _storeService.GetAllStores())
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
//vendors
model.AvailableVendors.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var v in await _vendorService.GetAllVendors(showHidden: true))
- model.AvailableVendors.Add(new SelectListItem { Text = v.Name, Value = v.Id.ToString() });
+ model.AvailableVendors.Add(new SelectListItem { Text = v.Name, Value = v.Id });
//product types
model.AvailableProductTypes = ProductType.SimpleProduct.ToSelectList(_translationService, _workContext, false).ToList();
@@ -1356,7 +1356,7 @@ namespace Grand.Web.Admin.Services
public virtual async Task InsertCustomerAddProductModel(string customerId, bool personalized, CustomerModel.AddProductModel model)
{
- foreach (string id in model.SelectedProductIds)
+ foreach (var id in model.SelectedProductIds)
{
var product = await _productService.GetProductById(id);
if (product != null)
@@ -1365,14 +1365,14 @@ namespace Grand.Web.Admin.Services
{
if (!(await _customerProductService.GetPriceByCustomerProduct(customerId, id)).HasValue)
{
- await _customerProductService.InsertCustomerProductPrice(new CustomerProductPrice() { CustomerId = customerId, ProductId = id, Price = product.Price });
+ await _customerProductService.InsertCustomerProductPrice(new CustomerProductPrice { CustomerId = customerId, ProductId = id, Price = product.Price });
}
}
else
{
if (await _customerProductService.GetCustomerProduct(customerId, id) == null)
{
- await _customerProductService.InsertCustomerProduct(new CustomerProduct() { CustomerId = customerId, ProductId = id, DisplayOrder = 0 });
+ await _customerProductService.InsertCustomerProduct(new CustomerProduct { CustomerId = customerId, ProductId = id, DisplayOrder = 0 });
}
}
@@ -1464,7 +1464,7 @@ namespace Grand.Web.Admin.Services
StoreName = store != null ? store.Shortcut : "Unknown",
ProductId = x.ProductId,
ProductName = product != null ? product.Name : "Unknown",
- AttributeDescription = x.Attributes != null || !x.Attributes.Any() ? "" : await productAttributeFormatter.FormatAttributes(product, x.Attributes),
+ AttributeDescription = x.Attributes != null || !x.Attributes!.Any() ? "" : await productAttributeFormatter.FormatAttributes(product, x.Attributes),
CreatedOn = _dateTimeService.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc)
};
items.Add(m);
@@ -1484,7 +1484,7 @@ namespace Grand.Web.Admin.Services
Id = customerNote.Id,
CustomerId = customerId,
DownloadId = string.IsNullOrEmpty(customerNote.DownloadId) ? "" : customerNote.DownloadId,
- DownloadGuid = download != null ? download.DownloadGuid : Guid.Empty,
+ DownloadGuid = download?.DownloadGuid ?? Guid.Empty,
DisplayToCustomer = customerNote.DisplayToCustomer,
Title = customerNote.Title,
Note = customerNote.Note,
@@ -1501,7 +1501,7 @@ namespace Grand.Web.Admin.Services
Note = message,
DownloadId = downloadId,
CustomerId = customerId,
- CreatedOnUtc = DateTime.UtcNow,
+ CreatedOnUtc = DateTime.UtcNow
};
await _customerNoteService.InsertCustomerNote(customerNote);
diff --git a/src/Web/Grand.Web.Admin/Services/DiscountViewModelService.cs b/src/Web/Grand.Web.Admin/Services/DiscountViewModelService.cs
index a0024ed00..59c06cf11 100644
--- a/src/Web/Grand.Web.Admin/Services/DiscountViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/DiscountViewModelService.cs
@@ -16,6 +16,7 @@ using Grand.Domain.Discounts;
using Grand.Domain.Vendors;
using Grand.Infrastructure;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Catalog;
using Grand.Web.Admin.Models.Discounts;
@@ -25,7 +26,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Services
{
- public partial class DiscountViewModelService : IDiscountViewModelService
+ public class DiscountViewModelService : IDiscountViewModelService
{
#region Fields
@@ -87,17 +88,22 @@ namespace Grand.Web.Admin.Services
public virtual DiscountListModel PrepareDiscountListModel()
{
var model = new DiscountListModel {
- AvailableDiscountTypes = DiscountType.AssignedToOrderTotal.ToSelectList(_translationService, _workContext, false).ToList()
+ AvailableDiscountTypes = DiscountType.AssignedToOrderTotal
+ .ToSelectList(_translationService, _workContext, false).ToList()
};
- model.AvailableDiscountTypes.Insert(0, new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" });
+ model.AvailableDiscountTypes.Insert(0,
+ new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" });
return model;
}
- public virtual async Task<(IEnumerable<DiscountModel> discountModel, int totalCount)> PrepareDiscountModel(DiscountListModel model, int pageIndex, int pageSize)
+
+ public virtual async Task<(IEnumerable<DiscountModel> discountModel, int totalCount)> PrepareDiscountModel(
+ DiscountListModel model, int pageIndex, int pageSize)
{
DiscountType? discountType = null;
if (model.SearchDiscountTypeId > 0)
discountType = (DiscountType)model.SearchDiscountTypeId;
- var discounts = await _discountService.GetAllDiscounts(discountType, _workContext.CurrentCustomer.StaffStoreId,
+ var discounts = await _discountService.GetAllDiscounts(discountType,
+ _workContext.CurrentCustomer.StaffStoreId,
null,
model.SearchDiscountCouponCode,
model.SearchDiscountName,
@@ -107,9 +113,11 @@ namespace Grand.Web.Admin.Services
{
var discountModel = x.ToModel(_dateTimeService);
discountModel.DiscountTypeName = x.DiscountTypeId.GetTranslationEnum(_translationService, _workContext);
- discountModel.TimesUsed = (await _discountService.GetAllDiscountUsageHistory(x.Id, pageSize: 1)).TotalCount;
+ discountModel.TimesUsed =
+ (await _discountService.GetAllDiscountUsageHistory(x.Id, pageSize: 1)).TotalCount;
items.Add(discountModel);
- };
+ }
+
return (items, discounts.Count);
}
@@ -118,20 +126,26 @@ namespace Grand.Web.Admin.Services
if (model == null)
throw new ArgumentNullException(nameof(model));
- model.AvailableDiscountRequirementRules.Add(new SelectListItem { Text = _translationService.GetResource("admin.marketing.discounts.Requirements.DiscountRequirementType.Select"), Value = "" });
+ model.AvailableDiscountRequirementRules.Add(new SelectListItem {
+ Text = _translationService.GetResource(
+ "admin.marketing.discounts.Requirements.DiscountRequirementType.Select"),
+ Value = ""
+ });
var discountPlugins = _discountService.LoadAllDiscountProviders();
foreach (var discountPlugin in discountPlugins)
- foreach (var discountRule in discountPlugin.GetRequirementRules())
- model.AvailableDiscountRequirementRules.Add(new SelectListItem { Text = discountRule.FriendlyName, Value = discountRule.SystemName });
+ foreach (var discountRule in discountPlugin.GetRequirementRules())
+ model.AvailableDiscountRequirementRules.Add(new SelectListItem
+ { Text = discountRule.FriendlyName, Value = discountRule.SystemName });
var currencies = await _currencyService.GetAllCurrencies();
foreach (var item in currencies)
{
- model.AvailableCurrencies.Add(new SelectListItem() { Text = item.Name, Value = item.CurrencyCode });
+ model.AvailableCurrencies.Add(new SelectListItem { Text = item.Name, Value = item.CurrencyCode });
}
+
//discount amount providers
foreach (var item in _discountService.LoadDiscountAmountProviders())
{
- model.AvailableDiscountAmountProviders.Add(new SelectListItem() { Value = item.SystemName, Text = item.FriendlyName });
+ model.AvailableDiscountAmountProviders.Add(new SelectListItem { Value = item.SystemName, Text = item.FriendlyName });
}
if (discount != null)
@@ -139,23 +153,23 @@ namespace Grand.Web.Admin.Services
//requirements
foreach (var dr in discount.DiscountRules.OrderBy(dr => dr.Id))
{
- var discountPlugin = _discountService.LoadDiscountProviderByRuleSystemName(dr.DiscountRequirementRuleSystemName);
- var discountRequirement = discountPlugin.GetRequirementRules().Single(x => x.SystemName == dr.DiscountRequirementRuleSystemName);
+ var discountPlugin =
+ _discountService.LoadDiscountProviderByRuleSystemName(dr.DiscountRequirementRuleSystemName);
+ var discountRequirement = discountPlugin.GetRequirementRules()
+ .Single(x => x.SystemName == dr.DiscountRequirementRuleSystemName);
{
- if (discountPlugin != null)
- {
- model.DiscountRequirementMetaInfos.Add(new DiscountModel.DiscountRequirementMetaInfo {
- DiscountRequirementId = dr.Id,
- RuleName = discountRequirement.FriendlyName,
- ConfigurationUrl = GetRequirementUrlInternal(discountRequirement, discount, dr.Id)
- });
- }
+ model.DiscountRequirementMetaInfos.Add(new DiscountModel.DiscountRequirementMetaInfo {
+ DiscountRequirementId = dr.Id,
+ RuleName = discountRequirement.FriendlyName,
+ ConfigurationUrl = GetRequirementUrlInternal(discountRequirement, discount, dr.Id)
+ });
}
}
}
else
model.IsEnabled = true;
}
+
public virtual async Task<Discount> InsertDiscountModel(DiscountModel model)
{
var discount = model.ToEntity(_dateTimeService);
@@ -185,10 +199,11 @@ namespace Grand.Web.Admin.Services
//update "HasDiscountsApplied" property
foreach (var category in categories)
{
- var item = category.AppliedDiscounts.Where(x => x == discount.Id).FirstOrDefault();
+ var item = category.AppliedDiscounts.FirstOrDefault(x => x == discount.Id);
category.AppliedDiscounts.Remove(item);
}
}
+
if (prevDiscountType == DiscountType.AssignedToCollections
&& discount.DiscountTypeId != DiscountType.AssignedToCollections)
{
@@ -196,10 +211,11 @@ namespace Grand.Web.Admin.Services
var collections = await _collectionService.GetAllCollectionsByDiscount(discount.Id);
foreach (var collection in collections)
{
- var item = collection.AppliedDiscounts.Where(x => x == discount.Id).FirstOrDefault();
+ var item = collection.AppliedDiscounts.FirstOrDefault(x => x == discount.Id);
collection.AppliedDiscounts.Remove(item);
}
}
+
if (prevDiscountType == DiscountType.AssignedToSkus
&& discount.DiscountTypeId != DiscountType.AssignedToSkus)
{
@@ -208,7 +224,7 @@ namespace Grand.Web.Admin.Services
foreach (var p in products)
{
- var item = p.AppliedDiscounts.Where(x => x == discount.Id).FirstOrDefault();
+ var item = p.AppliedDiscounts.FirstOrDefault(x => x == discount.Id);
p.AppliedDiscounts.Remove(item);
await _productService.DeleteDiscount(item, p.Id);
}
@@ -219,8 +235,8 @@ namespace Grand.Web.Admin.Services
_workContext.CurrentCustomer, _httpContextAccessor.HttpContext?.Connection?.RemoteIpAddress?.ToString(),
_translationService.GetResource("ActivityLog.EditDiscount"), discount.Name);
return discount;
-
}
+
public virtual async Task DeleteDiscount(Discount discount)
{
await _discountService.DeleteDiscount(discount);
@@ -229,6 +245,7 @@ namespace Grand.Web.Admin.Services
_workContext.CurrentCustomer, _httpContextAccessor.HttpContext?.Connection?.RemoteIpAddress?.ToString(),
_translationService.GetResource("ActivityLog.DeleteDiscount"), discount.Name);
}
+
public virtual async Task InsertCouponCode(string discountId, string couponCode)
{
var coupon = new DiscountCoupon {
@@ -237,7 +254,9 @@ namespace Grand.Web.Admin.Services
};
await _discountService.InsertDiscountCoupon(coupon);
}
- public virtual string GetRequirementUrlInternal(IDiscountRule discountRequirementRule, Discount discount, string discountRequirementId)
+
+ public virtual string GetRequirementUrlInternal(IDiscountRule discountRequirementRule, Discount discount,
+ string discountRequirementId)
{
if (discountRequirementRule == null)
throw new ArgumentNullException(nameof(discountRequirementRule));
@@ -247,7 +266,8 @@ namespace Grand.Web.Admin.Services
var storeLocation = _workContext.CurrentHost.Url.TrimEnd('/');
- string url = string.Format("{0}/{1}", storeLocation, discountRequirementRule.GetConfigurationUrl(discount.Id, discountRequirementId));
+ var url =
+ $"{storeLocation}/{discountRequirementRule.GetConfigurationUrl(discount.Id, discountRequirementId)}";
return url;
}
@@ -261,28 +281,36 @@ namespace Grand.Web.Admin.Services
{
var model = new DiscountModel.AddProductToDiscountModel();
//stores
- model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
+ model.AvailableStores.Add(new SelectListItem
+ { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var s in await _storeService.GetAllStores())
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
//vendors
- model.AvailableVendors.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
+ model.AvailableVendors.Add(new SelectListItem
+ { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var v in await _vendorService.GetAllVendors(showHidden: true))
- model.AvailableVendors.Add(new SelectListItem { Text = v.Name, Value = v.Id.ToString() });
+ model.AvailableVendors.Add(new SelectListItem { Text = v.Name, Value = v.Id });
//product types
model.AvailableProductTypes = ProductType.SimpleProduct.ToSelectList().ToList();
- model.AvailableProductTypes.Insert(0, new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
+ model.AvailableProductTypes.Insert(0,
+ new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
return model;
}
- public virtual async Task<(IList<ProductModel> products, int totalCount)> PrepareProductModel(DiscountModel.AddProductToDiscountModel model, int pageIndex, int pageSize)
+
+ public virtual async Task<(IList<ProductModel> products, int totalCount)> PrepareProductModel(
+ DiscountModel.AddProductToDiscountModel model, int pageIndex, int pageSize)
{
- var products = await _productService.PrepareProductList(model.SearchCategoryId, model.SearchBrandId, model.SearchCollectionId, model.SearchStoreId, model.SearchVendorId, model.SearchProductTypeId, model.SearchProductName, pageIndex, pageSize);
+ var products = await _productService.PrepareProductList(model.SearchCategoryId, model.SearchBrandId,
+ model.SearchCollectionId, model.SearchStoreId, model.SearchVendorId, model.SearchProductTypeId,
+ model.SearchProductName, pageIndex, pageSize);
return (products.Select(x => x.ToModel(_dateTimeService)).ToList(), products.TotalCount);
}
+
public virtual async Task InsertProductToDiscountModel(DiscountModel.AddProductToDiscountModel model)
{
- foreach (string id in model.SelectedProductIds)
+ foreach (var id in model.SelectedProductIds)
{
var product = await _productService.GetProductById(id);
if (product != null)
@@ -295,6 +323,7 @@ namespace Grand.Web.Admin.Services
}
}
}
+
public virtual async Task DeleteProduct(Discount discount, Product product)
{
//remove discount
@@ -304,6 +333,7 @@ namespace Grand.Web.Admin.Services
await _productService.DeleteDiscount(discount.Id, product.Id);
}
}
+
public virtual async Task DeleteCategory(Discount discount, Category category)
{
//remove discount
@@ -312,9 +342,10 @@ namespace Grand.Web.Admin.Services
await _categoryService.UpdateCategory(category);
}
+
public virtual async Task InsertCategoryToDiscountModel(DiscountModel.AddCategoryToDiscountModel model)
{
- foreach (string id in model.SelectedCategoryIds)
+ foreach (var id in model.SelectedCategoryIds)
{
var category = await _categoryService.GetCategoryById(id);
if (category != null)
@@ -326,6 +357,7 @@ namespace Grand.Web.Admin.Services
}
}
}
+
public virtual async Task DeleteCollection(Discount discount, Collection collection)
{
//remove discount
@@ -334,9 +366,10 @@ namespace Grand.Web.Admin.Services
await _collectionService.UpdateCollection(collection);
}
+
public virtual async Task InsertBrandToDiscountModel(DiscountModel.AddBrandToDiscountModel model)
{
- foreach (string id in model.SelectedBrandIds)
+ foreach (var id in model.SelectedBrandIds)
{
var brand = await _brandService.GetBrandById(id);
if (brand != null)
@@ -348,6 +381,7 @@ namespace Grand.Web.Admin.Services
}
}
}
+
public virtual async Task DeleteBrand(Discount discount, Brand brand)
{
//remove discount
@@ -356,9 +390,10 @@ namespace Grand.Web.Admin.Services
await _brandService.UpdateBrand(brand);
}
+
public virtual async Task InsertCollectionToDiscountModel(DiscountModel.AddCollectionToDiscountModel model)
{
- foreach (string id in model.SelectedCollectionIds)
+ foreach (var id in model.SelectedCollectionIds)
{
var collection = await _collectionService.GetCollectionById(id);
if (collection != null)
@@ -370,6 +405,7 @@ namespace Grand.Web.Admin.Services
}
}
}
+
public virtual async Task DeleteVendor(Discount discount, Vendor vendor)
{
//remove discount
@@ -378,9 +414,10 @@ namespace Grand.Web.Admin.Services
await _vendorService.UpdateVendor(vendor);
}
+
public virtual async Task InsertVendorToDiscountModel(DiscountModel.AddVendorToDiscountModel model)
{
- foreach (string id in model.SelectedVendorIds)
+ foreach (var id in model.SelectedVendorIds)
{
var vendor = await _vendorService.GetVendorById(id);
if (vendor != null)
@@ -393,9 +430,12 @@ namespace Grand.Web.Admin.Services
}
}
- public virtual async Task<(IEnumerable<DiscountModel.DiscountUsageHistoryModel> usageHistoryModels, int totalCount)> PrepareDiscountUsageHistoryModel(Discount discount, int pageIndex, int pageSize)
+ public virtual async
+ Task<(IEnumerable<DiscountModel.DiscountUsageHistoryModel> usageHistoryModels, int totalCount)>
+ PrepareDiscountUsageHistoryModel(Discount discount, int pageIndex, int pageSize)
{
- var duh = await _discountService.GetAllDiscountUsageHistory(discount.Id, null, null, null, pageIndex - 1, pageSize);
+ var duh = await _discountService.GetAllDiscountUsageHistory(discount.Id, null, null, null, pageIndex - 1,
+ pageSize);
var items = new List<DiscountModel.DiscountUsageHistoryModel>();
foreach (var x in duh)
@@ -405,15 +445,15 @@ namespace Grand.Web.Admin.Services
Id = x.Id,
DiscountId = x.DiscountId,
OrderId = x.OrderId,
- OrderNumber = order != null ? order.OrderNumber : 0,
+ OrderNumber = order?.OrderNumber ?? 0,
OrderCode = order != null ? order.Code : "",
OrderTotal = order != null ? _priceFormatter.FormatPrice(order.OrderTotal, false) : "",
CreatedOn = _dateTimeService.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc)
};
items.Add(duhModel);
-
}
+
return (items, duh.TotalCount);
}
}
-}
+}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Services/DocumentViewModelService.cs b/src/Web/Grand.Web.Admin/Services/DocumentViewModelService.cs
index 495fc67da..442ef05d5 100644
--- a/src/Web/Grand.Web.Admin/Services/DocumentViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/DocumentViewModelService.cs
@@ -11,7 +11,7 @@ using Grand.Business.Core.Interfaces.Storage;
using Grand.Domain.Common;
using Grand.Domain.Documents;
using Grand.Infrastructure;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Documents;
using Microsoft.AspNetCore.Http;
@@ -90,7 +90,7 @@ namespace Grand.Web.Admin.Services
public virtual async Task<DocumentModel> PrepareDocumentModel(DocumentModel documentModel, Document document, SimpleDocumentModel simpleModel)
{
- var model = documentModel == null ? new DocumentModel() { Published = true } : documentModel;
+ var model = documentModel ?? new DocumentModel { Published = true };
if (document != null)
model = document.ToModel();
else
@@ -184,8 +184,6 @@ namespace Grand.Web.Admin.Services
}
}
break;
- default:
- break;
}
}
}
diff --git a/src/Web/Grand.Web.Admin/Services/ElFinderViewModelService.cs b/src/Web/Grand.Web.Admin/Services/ElFinderViewModelService.cs
index b18e25a22..fecf961fb 100644
--- a/src/Web/Grand.Web.Admin/Services/ElFinderViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/ElFinderViewModelService.cs
@@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Routing;
namespace Grand.Web.Admin.Services
{
- public partial class ElFinderViewModelService : IElFinderViewModelService
+ public class ElFinderViewModelService : IElFinderViewModelService
{
private readonly IDriver _driver;
private readonly IConnector _connector;
@@ -65,7 +65,7 @@ namespace Grand.Web.Admin.Services
}
_fullPathToThumbs = thumbs.PhysicalPath;
- _urlThumb = $"{_linkGenerator.GetPathByAction(_httpContextAccessor.HttpContext, "Thumb", "ElFinder", new { area = "Admin" })}/";
+ _urlThumb = $"{_linkGenerator.GetPathByAction(_httpContextAccessor.HttpContext!, "Thumb", "ElFinder", new { area = "Admin" })}/";
}
protected virtual bool NotAllowedExtensions(string extensions)
@@ -91,24 +91,23 @@ namespace Grand.Web.Admin.Services
_urlThumb) {
Name = "Volume",
MaxUploadConnections = 3,
- MaxUploadSizeInMb = 4
- };
- volume.ObjectAttributes = new List<FilteredObjectAttribute>() {
- new FilteredObjectAttribute()
- {
- FileFilter = (file) => {
- return NotAllowedExtensions(file.Extension);
- },
- ObjectFilter = (obj) =>
- {
- var extensions = Path.GetExtension(obj.FullName);
- if(!string.IsNullOrEmpty(extensions))
- return NotAllowedExtensions(extensions);
-
- return false;
- },
- ShowOnly = false, Access = false, Visible = false, Write = false, Read = false
- },
+ MaxUploadSizeInMb = 4,
+ ObjectAttributes = new List<FilteredObjectAttribute> {
+ new FilteredObjectAttribute {
+ FileFilter = file => {
+ return NotAllowedExtensions(file.Extension);
+ },
+ ObjectFilter = obj =>
+ {
+ var extensions = Path.GetExtension(obj.FullName);
+ if(!string.IsNullOrEmpty(extensions))
+ return NotAllowedExtensions(extensions);
+
+ return false;
+ },
+ ShowOnly = false, Access = false, Visible = false, Write = false, Read = false
+ }
+ }
};
_connector.AddVolume(volume);
await volume.Driver.SetupVolumeAsync(volume);
diff --git a/src/Web/Grand.Web.Admin/Services/EmailAccountViewModelService.cs b/src/Web/Grand.Web.Admin/Services/EmailAccountViewModelService.cs
index 2cec13f77..693b13b70 100644
--- a/src/Web/Grand.Web.Admin/Services/EmailAccountViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/EmailAccountViewModelService.cs
@@ -1,12 +1,12 @@
using Grand.Business.Core.Interfaces.Messages;
using Grand.Domain.Messages;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Messages;
namespace Grand.Web.Admin.Services
{
- public partial class EmailAccountViewModelService : IEmailAccountViewModelService
+ public class EmailAccountViewModelService : IEmailAccountViewModelService
{
private readonly IEmailAccountService _emailAccountService;
private readonly IEmailSender _emailSender;
@@ -45,8 +45,8 @@ namespace Grand.Web.Admin.Services
public virtual async Task SendTestEmail(EmailAccount emailAccount, EmailAccountModel model)
{
- string subject = "Testing email functionality.";
- string body = "Email works fine.";
+ var subject = "Testing email functionality.";
+ var body = "Email works fine.";
await _emailSender.SendEmail(emailAccount, subject, body, emailAccount.Email, emailAccount.DisplayName, model.SendTestEmailTo, null);
}
}
diff --git a/src/Web/Grand.Web.Admin/Services/GiftVoucherViewModelService.cs b/src/Web/Grand.Web.Admin/Services/GiftVoucherViewModelService.cs
index 56f74eb82..e28439dbf 100644
--- a/src/Web/Grand.Web.Admin/Services/GiftVoucherViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/GiftVoucherViewModelService.cs
@@ -8,16 +8,16 @@ using Grand.Business.Core.Interfaces.Messages;
using Grand.Infrastructure;
using Grand.Domain.Localization;
using Grand.Domain.Orders;
-using Grand.Web.Admin.Extensions;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Orders;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Http;
using Grand.Business.Core.Interfaces.Common.Stores;
+using Grand.Web.Admin.Extensions.Mapping;
namespace Grand.Web.Admin.Services
{
- public partial class GiftVoucherViewModelService : IGiftVoucherViewModelService
+ public class GiftVoucherViewModelService : IGiftVoucherViewModelService
{
#region Fields
@@ -75,8 +75,8 @@ namespace Grand.Web.Admin.Services
model.AvailableCurrencies.Add(new SelectListItem { Text = currency.Name, Value = currency.CurrencyCode });
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" });
- foreach (var s in (await _storeService.GetAllStores()))
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ foreach (var s in await _storeService.GetAllStores())
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
return model;
}
@@ -117,9 +117,7 @@ namespace Grand.Web.Admin.Services
foreach (var item in giftVouchers)
{
var gift = item.ToModel(_dateTimeService);
- var currency = await _currencyService.GetCurrencyByCode(item.CurrencyCode);
- if (currency == null)
- currency = await _currencyService.GetPrimaryStoreCurrency();
+ var currency = await _currencyService.GetCurrencyByCode(item.CurrencyCode) ?? await _currencyService.GetPrimaryStoreCurrency();
gift.RemainingAmountStr = _priceFormatter.FormatPrice(item.GetGiftVoucherRemainingAmount(), currency, _workContext.WorkingLanguage, true, false);
gift.AmountStr = _priceFormatter.FormatPrice(item.Amount, currency, _workContext.WorkingLanguage, true, false);
@@ -148,11 +146,9 @@ namespace Grand.Web.Admin.Services
if (giftVoucher.PurchasedWithOrderItem != null)
order = await _orderService.GetOrderByOrderItemId(giftVoucher.PurchasedWithOrderItem.Id);
- var currency = await _currencyService.GetCurrencyByCode(giftVoucher.CurrencyCode);
- if (currency == null)
- currency = await _currencyService.GetPrimaryStoreCurrency();
+ var currency = await _currencyService.GetCurrencyByCode(giftVoucher.CurrencyCode) ?? await _currencyService.GetPrimaryStoreCurrency();
- model.PurchasedWithOrderId = giftVoucher.PurchasedWithOrderItem != null ? order.Id : null;
+ model.PurchasedWithOrderId = giftVoucher.PurchasedWithOrderItem != null ? order?.Id : null;
model.RemainingAmountStr = _priceFormatter.FormatPrice(giftVoucher.GetGiftVoucherRemainingAmount(), currency, _workContext.WorkingLanguage, true, false);
model.AmountStr = _priceFormatter.FormatPrice(giftVoucher.Amount, currency, _workContext.WorkingLanguage, true, false);
model.CreatedOn = _dateTimeService.ConvertToUserTime(giftVoucher.CreatedOnUtc, DateTimeKind.Utc);
@@ -166,9 +162,7 @@ namespace Grand.Web.Admin.Services
var languageId = "";
if (order != null)
{
- var customerLang = await _languageService.GetLanguageById(order.CustomerLanguageId);
- if (customerLang == null)
- customerLang = (await _languageService.GetAllLanguages()).FirstOrDefault();
+ var customerLang = await _languageService.GetLanguageById(order.CustomerLanguageId) ?? (await _languageService.GetAllLanguages()).FirstOrDefault();
if (customerLang != null)
languageId = customerLang.Id;
}
@@ -176,7 +170,7 @@ namespace Grand.Web.Admin.Services
{
languageId = _languageSettings.DefaultAdminLanguageId;
}
- int queuedEmailId = await _messageProviderService.SendGiftVoucherMessage(giftVoucher, order, languageId);
+ var queuedEmailId = await _messageProviderService.SendGiftVoucherMessage(giftVoucher, order, languageId);
if (queuedEmailId > 0)
{
giftVoucher.IsRecipientNotified = true;
@@ -213,9 +207,7 @@ namespace Grand.Web.Admin.Services
if (giftVoucher.PurchasedWithOrderItem != null)
order = await _orderService.GetOrderByOrderItemId(giftVoucher.PurchasedWithOrderItem.Id);
- var currency = await _currencyService.GetCurrencyByCode(giftVoucher.CurrencyCode);
- if (currency == null)
- currency = await _currencyService.GetPrimaryStoreCurrency();
+ var currency = await _currencyService.GetCurrencyByCode(giftVoucher.CurrencyCode) ?? await _currencyService.GetPrimaryStoreCurrency();
model.PurchasedWithOrderId = giftVoucher.PurchasedWithOrderItem != null ? order?.Id : null;
model.PurchasedWithOrderNumber = order?.OrderNumber ?? 0;
@@ -227,9 +219,7 @@ namespace Grand.Web.Admin.Services
}
public virtual async Task<(IEnumerable<GiftVoucherModel.GiftVoucherUsageHistoryModel> giftVoucherUsageHistoryModels, int totalCount)> PrepareGiftVoucherUsageHistoryModels(GiftVoucher giftVoucher, int pageIndex, int pageSize)
{
- var currency = await _currencyService.GetCurrencyByCode(giftVoucher.CurrencyCode);
- if (currency == null)
- currency = await _currencyService.GetPrimaryStoreCurrency();
+ var currency = await _currencyService.GetCurrencyByCode(giftVoucher.CurrencyCode) ?? await _currencyService.GetPrimaryStoreCurrency();
var items = new List<GiftVoucherModel.GiftVoucherUsageHistoryModel>();
foreach (var x in giftVoucher.GiftVoucherUsageHistory.OrderByDescending(gcuh => gcuh.CreatedOnUtc))
@@ -239,7 +229,7 @@ namespace Grand.Web.Admin.Services
{
Id = x.Id,
OrderId = x.UsedWithOrderId,
- OrderNumber = order != null ? order.OrderNumber : 0,
+ OrderNumber = order?.OrderNumber ?? 0,
UsedValue = _priceFormatter.FormatPrice(x.UsedValue, currency, _workContext.WorkingLanguage, true, false),
CreatedOn = _dateTimeService.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc)
});
diff --git a/src/Web/Grand.Web.Admin/Services/GoogleAnalyticsViewModelService.cs b/src/Web/Grand.Web.Admin/Services/GoogleAnalyticsViewModelService.cs
deleted file mode 100644
index 20f5eaa50..000000000
--- a/src/Web/Grand.Web.Admin/Services/GoogleAnalyticsViewModelService.cs
+++ /dev/null
@@ -1,337 +0,0 @@
-using Google.Apis.AnalyticsReporting.v4;
-using Google.Apis.AnalyticsReporting.v4.Data;
-using Google.Apis.Auth.OAuth2;
-using Google.Apis.Services;
-using Grand.Business.Core.Interfaces.Common.Localization;
-using Grand.Business.Core.Interfaces.Common.Logging;
-using Grand.Domain.Seo;
-using Grand.Web.Admin.Interfaces;
-using Grand.Web.Admin.Models.Common;
-
-namespace Grand.Web.Admin.Services
-{
- public partial class GoogleAnalyticsViewModelService : IGoogleAnalyticsViewModelService
- {
- #region Fields
-
- private readonly GoogleAnalyticsSettings _googleAnalyticsSettings;
- private readonly ITranslationService _translationService;
- private readonly ILogger _logger;
-
-
- private async Task<AnalyticsReportingService> _analyticsReportingService()
- {
- try
- {
- var scopes = new[] { AnalyticsReportingService.Scope.Analytics };
- var temp = new ServiceAccountCredential.Initializer(_googleAnalyticsSettings.gaserviceAccountEmail) { Scopes = scopes };
- string privateKey = _googleAnalyticsSettings.gaprivateKey.Replace("\\n", "\n");
- var credential = new ServiceAccountCredential(temp.FromPrivateKey(privateKey));
-
- return new AnalyticsReportingService(new BaseClientService.Initializer() {
- HttpClientInitializer = credential,
- ApplicationName = "GrandNode",
- });
- }
- catch (Exception ex)
- {
- await _logger.InsertLog(Domain.Logging.LogLevel.Error, "GoogleAnalytics", ex.Message);
- return await Task.FromResult<AnalyticsReportingService>(null);
- }
- }
-
- #endregion
-
- #region Ctor
- public GoogleAnalyticsViewModelService(GoogleAnalyticsSettings googleAnalyticsSettings,
- ITranslationService translationService, ILogger logger)
- {
- _googleAnalyticsSettings = googleAnalyticsSettings;
- _translationService = translationService;
- _logger = logger;
- }
- #endregion
-
- #region Utilities
-
- private GoogleAnalyticsResultModel ParseResponse(GetReportsResponse response, DateTime startDate, DateTime endDate)
- {
- var result = new GoogleAnalyticsResultModel();
-
- result.StartDate = startDate.ToString();
- result.EndDate = endDate.ToString();
-
- foreach (var report in response.Reports)
- {
- ColumnHeader header = report.ColumnHeader;
- IList<string> dimensionHeaders = header.Dimensions;
- IList<MetricHeaderEntry> metricHeaders = header.MetricHeader.MetricHeaderEntries;
- IList<ReportRow> rows = report.Data.Rows;
- if (rows == null)
- rows = new List<ReportRow>();
-
- const int MAX_RECORDS = 10;
- int recordCount;
- if (rows.Count > 10) recordCount = MAX_RECORDS; //if needed, this code limits quantity of records up to 10
- else recordCount = rows.Count;
-
- //recordCount will determine how quantity to save into collection
- for (int a = 0; a < recordCount; ++a)
- {
- IList<string> dimensions = rows[a].Dimensions;
- IList<DateRangeValues> metrics = rows[a].Metrics;
-
- var newRecord = new Dictionary<string, string>();
- for (int i = 0; i < dimensionHeaders.Count && i < dimensions.Count; ++i)
- {
- newRecord.Add(dimensionHeaders[i], dimensions[i]);
- }
- for (int v = 0; v < metricHeaders.Count; ++v)
- {
- newRecord.Add(metricHeaders[v].Name, metrics[0].Values[v]);
- }
- result.Records.Add(newRecord);
- }
- }
- return result;
- }
-
- private GoogleAnalyticsResultModel ReturnEmpty()
- {
- if (string.IsNullOrEmpty(_googleAnalyticsSettings.gaprivateKey))
- return new GoogleAnalyticsResultModel() { Message = _translationService.GetResource("Admin.Settings.GeneralCommon.GoogleAnalytics.help") };
- else
- return new GoogleAnalyticsResultModel() { Message = _translationService.GetResource("Admin.Settings.GeneralCommon.GoogleAnalytics.help2") };
- }
-
- #endregion
-
- public virtual async Task<GoogleAnalyticsResultModel> GetDataByGeneral(DateTime startDate, DateTime endDate)
- {
- if (await _analyticsReportingService() == null)
- {
- return ReturnEmpty();
- }
-
- // metrics and dimensions below are tailored to suit current needings
- //in case of needing to use different or more metrics or dimensions, see link below
- //https://developers.google.com/analytics/devguides/reporting/core/dimsmets
- //it would be nice just to pass metrics and dimensions to this method, but it will surely incerase complexity
- //and get rid of tidy and neat "fire-n-get" method that requires simple arguments
-
-
- //DateRange
- IList<DateRange> dateRanges = new List<DateRange>();
- dateRanges.Add(new DateRange() { StartDate = startDate.ToString("yyyy-MM-dd"), EndDate = endDate.ToString("yyyy-MM-dd") });
-
- //Metric
- IList<Metric> metrics = new List<Metric>();
- metrics.Add(new Metric() { Expression = "ga:users", Alias = "Users" });
- metrics.Add(new Metric() { Expression = "ga:newUsers", Alias = "Unique users" });
- metrics.Add(new Metric() { Expression = "ga:pageviews", Alias = "Views" });
-
- //Dimension
- IList<Dimension> dimensions = new List<Dimension>();
- dimensions.Add(new Dimension() { Name = "ga:userType" });
-
- //OrderBy
- IList<OrderBy> orderBys = new List<OrderBy>();
- orderBys.Add(new OrderBy() { FieldName = "ga:pageviews", SortOrder = "DESCENDING", OrderType = "VALUE" });
-
- //final assembling
- ReportRequest request = new ReportRequest() {
- ViewId = _googleAnalyticsSettings.gaviewID,
- DateRanges = dateRanges,
- Metrics = metrics,
- Dimensions = dimensions,
- OrderBys = orderBys
- };
-
- List<ReportRequest> requests = new List<ReportRequest>();
- requests.Add(request);
-
- GetReportsRequest reportsRequest = new GetReportsRequest();
- reportsRequest.ReportRequests = requests;
-
- var response = await (await _analyticsReportingService()).Reports.BatchGet(reportsRequest).ExecuteAsync();
-
- return ParseResponse(response, startDate, endDate);
- }
- public virtual async Task<GoogleAnalyticsResultModel> GetDataByLocalization(DateTime startDate, DateTime endDate)
- {
- if (await _analyticsReportingService() == null)
- {
- return ReturnEmpty();
- }
-
- IList<DateRange> dateRanges = new List<DateRange>();
- dateRanges.Add(new DateRange() { StartDate = startDate.ToString("yyyy-MM-dd"), EndDate = endDate.ToString("yyyy-MM-dd") });
-
- //Metric
- IList<Metric> metrics = new List<Metric>();
- metrics.Add(new Metric() { Expression = "ga:users", Alias = "Users" });
- metrics.Add(new Metric() { Expression = "ga:newUsers", Alias = "Unique users" });
- metrics.Add(new Metric() { Expression = "ga:pageviews", Alias = "Views" });
-
- //Dimension
- IList<Dimension> dimensions = new List<Dimension>();
- dimensions.Add(new Dimension() { Name = "ga:country" });
- dimensions.Add(new Dimension() { Name = "ga:city" });
-
- //OrderBy
- IList<OrderBy> orderBys = new List<OrderBy>();
- orderBys.Add(new OrderBy() { FieldName = "ga:pageviews", SortOrder = "DESCENDING", OrderType = "VALUE" });
-
- //ReportRequest - final assembling
- ReportRequest request = new ReportRequest() {
- ViewId = _googleAnalyticsSettings.gaviewID,
- DateRanges = dateRanges,
- Metrics = metrics,
- Dimensions = dimensions,
- OrderBys = orderBys,
- };
-
- List<ReportRequest> requests = new List<ReportRequest>();
- requests.Add(request);
-
- GetReportsRequest reportsRequest = new GetReportsRequest();
- reportsRequest.ReportRequests = requests;
-
- var response = await (await _analyticsReportingService()).Reports.BatchGet(reportsRequest).ExecuteAsync();
-
- return ParseResponse(response, startDate, endDate);
-
- }
- public virtual async Task<GoogleAnalyticsResultModel> GetDataBySource(DateTime startDate, DateTime endDate)
- {
- if (await _analyticsReportingService() == null)
- {
- return ReturnEmpty();
- }
-
- IList<DateRange> dateRanges = new List<DateRange>();
- dateRanges.Add(new DateRange() { StartDate = startDate.ToString("yyyy-MM-dd"), EndDate = endDate.ToString("yyyy-MM-dd") });
-
- //Metric
- IList<Metric> metrics = new List<Metric>();
- metrics.Add(new Metric() { Expression = "ga:users", Alias = "Users" });
- metrics.Add(new Metric() { Expression = "ga:newUsers", Alias = "Unique users" });
- metrics.Add(new Metric() { Expression = "ga:pageviews", Alias = "Views" });
-
- //Dimension
- IList<Dimension> dimensions = new List<Dimension>();
- dimensions.Add(new Dimension() { Name = "ga:sourceMedium" });
-
- //OrderBy
- IList<OrderBy> orderBys = new List<OrderBy>();
- orderBys.Add(new OrderBy() { FieldName = "ga:pageviews", SortOrder = "DESCENDING", OrderType = "VALUE" });
-
- //final assembling
- ReportRequest request = new ReportRequest() {
- ViewId = _googleAnalyticsSettings.gaviewID,
- DateRanges = dateRanges,
- Metrics = metrics,
- Dimensions = dimensions,
- OrderBys = orderBys
- };
-
- List<ReportRequest> requests = new List<ReportRequest>();
- requests.Add(request);
-
- GetReportsRequest reportsRequest = new GetReportsRequest();
- reportsRequest.ReportRequests = requests;
-
- var response = await (await _analyticsReportingService()).Reports.BatchGet(reportsRequest).ExecuteAsync();
-
- return ParseResponse(response, startDate, endDate);
-
- }
- public virtual async Task<GoogleAnalyticsResultModel> GetDataByExit(DateTime startDate, DateTime endDate)
- {
- if (await _analyticsReportingService() == null)
- {
- return ReturnEmpty();
- }
-
- IList<DateRange> dateRanges = new List<DateRange>();
- dateRanges.Add(new DateRange() { StartDate = startDate.ToString("yyyy-MM-dd"), EndDate = endDate.ToString("yyyy-MM-dd") });
-
- //Metric
- IList<Metric> metrics = new List<Metric>();
- metrics.Add(new Metric() { Expression = "ga:users", Alias = "Users" });
- metrics.Add(new Metric() { Expression = "ga:newUsers", Alias = "Unique users" });
- metrics.Add(new Metric() { Expression = "ga:pageviews", Alias = "Views" });
-
- //Dimension
- IList<Dimension> dimensions = new List<Dimension>();
- dimensions.Add(new Dimension() { Name = "ga:exitPagePath" });
-
- //OrderBy
- IList<OrderBy> orderBys = new List<OrderBy>();
- orderBys.Add(new OrderBy() { FieldName = "ga:pageviews", SortOrder = "DESCENDING", OrderType = "VALUE" });
-
- //final assembling
- ReportRequest request = new ReportRequest() {
- ViewId = _googleAnalyticsSettings.gaviewID,
- DateRanges = dateRanges,
- Metrics = metrics,
- Dimensions = dimensions,
- OrderBys = orderBys
- };
-
- List<ReportRequest> requests = new List<ReportRequest>();
- requests.Add(request);
-
- GetReportsRequest reportsRequest = new GetReportsRequest();
- reportsRequest.ReportRequests = requests;
-
- var response = await (await _analyticsReportingService()).Reports.BatchGet(reportsRequest).ExecuteAsync();
-
- return ParseResponse(response, startDate, endDate);
-
- }
- public virtual async Task<GoogleAnalyticsResultModel> GetDataByDevice(DateTime startDate, DateTime endDate)
- {
- if (await _analyticsReportingService() == null)
- {
- return ReturnEmpty();
- }
- IList<DateRange> dateRanges = new List<DateRange>();
- dateRanges.Add(new DateRange() { StartDate = startDate.ToString("yyyy-MM-dd"), EndDate = endDate.ToString("yyyy-MM-dd") });
-
- //Metric
- IList<Metric> metrics = new List<Metric>();
- metrics.Add(new Metric() { Expression = "ga:users", Alias = "Users" });
- metrics.Add(new Metric() { Expression = "ga:newUsers", Alias = "Unique users" });
- metrics.Add(new Metric() { Expression = "ga:pageviews", Alias = "Views" });
-
- //Dimension
- IList<Dimension> dimensions = new List<Dimension>();
- //dimensions.Add(new Dimension() { Name = "ga:browser" });
- dimensions.Add(new Dimension() { Name = "ga:mobileDeviceInfo" });
-
- //OrderBy
- IList<OrderBy> orderBys = new List<OrderBy>();
- orderBys.Add(new OrderBy() { FieldName = "ga:pageviews", SortOrder = "DESCENDING", OrderType = "VALUE" });
-
- //final assembling
- var request = new ReportRequest() {
- ViewId = _googleAnalyticsSettings.gaviewID,
- DateRanges = dateRanges,
- Metrics = metrics,
- Dimensions = dimensions,
- OrderBys = orderBys
- };
-
- var requests = new List<ReportRequest>();
- requests.Add(request);
-
- var reportsRequest = new GetReportsRequest();
- reportsRequest.ReportRequests = requests;
-
- var response = await (await _analyticsReportingService()).Reports.BatchGet(reportsRequest).ExecuteAsync();
-
- return ParseResponse(response, startDate, endDate);
- }
- }
-}
diff --git a/src/Web/Grand.Web.Admin/Services/KnowledgebaseViewModelService.cs b/src/Web/Grand.Web.Admin/Services/KnowledgebaseViewModelService.cs
index 67b2db7b7..d7401bc1c 100644
--- a/src/Web/Grand.Web.Admin/Services/KnowledgebaseViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/KnowledgebaseViewModelService.cs
@@ -9,6 +9,7 @@ using Grand.Domain.Knowledgebase;
using Grand.Domain.Seo;
using Grand.Infrastructure;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Knowledgebase;
using Microsoft.AspNetCore.Http;
@@ -16,7 +17,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Services
{
- public partial class KnowledgebaseViewModelService : IKnowledgebaseViewModelService
+ public class KnowledgebaseViewModelService : IKnowledgebaseViewModelService
{
private readonly ITranslationService _translationService;
private readonly IKnowledgebaseService _knowledgebaseService;
@@ -53,9 +54,10 @@ namespace Grand.Web.Admin.Services
_seoSettings = seoSettings;
}
- protected virtual void FillChildNodes(TreeNode parentNode, List<ITreeNode> nodes)
+ protected virtual void FillChildNodes(TreeNode parentNode, IEnumerable<ITreeNode> nodes)
{
- var children = nodes.Where(x => x.ParentCategoryId == parentNode.id);
+ var treeNodes = nodes.ToList();
+ var children = treeNodes.Where(x => x.ParentCategoryId == parentNode.id);
foreach (var child in children)
{
var newNode = new TreeNode
@@ -66,7 +68,7 @@ namespace Grand.Web.Admin.Services
nodes = new List<TreeNode>()
};
- FillChildNodes(newNode, nodes);
+ FillChildNodes(newNode, treeNodes);
parentNode.nodes.Add(newNode);
}
@@ -180,8 +182,9 @@ namespace Grand.Web.Admin.Services
}
public virtual async Task<KnowledgebaseCategoryModel> PrepareKnowledgebaseCategoryModel()
{
- var model = new KnowledgebaseCategoryModel();
- model.Published = true;
+ var model = new KnowledgebaseCategoryModel {
+ Published = true
+ };
await PrepareCategory(model);
return model;
}
@@ -294,7 +297,7 @@ namespace Grand.Web.Admin.Services
if (article == null || related == null)
throw new ArgumentNullException("No article found with specified id");
- string toDelete = "";
+ var toDelete = "";
foreach (var item in article.RelatedArticles)
{
if (item == related.Id)
diff --git a/src/Web/Grand.Web.Admin/Services/LanguageViewModelService.cs b/src/Web/Grand.Web.Admin/Services/LanguageViewModelService.cs
index a5a8525a2..ac359ea9c 100644
--- a/src/Web/Grand.Web.Admin/Services/LanguageViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/LanguageViewModelService.cs
@@ -1,15 +1,15 @@
using Grand.Domain.Localization;
using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Common.Localization;
-using Grand.Web.Admin.Extensions;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Localization;
using Microsoft.AspNetCore.Mvc.Rendering;
using Grand.SharedKernel.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
namespace Grand.Web.Admin.Services
{
- public partial class LanguageViewModelService : ILanguageViewModelService
+ public class LanguageViewModelService : ILanguageViewModelService
{
#region Fields
@@ -59,7 +59,7 @@ namespace Grand.Web.Admin.Services
model.AvailableCurrencies.Add(new SelectListItem
{
Text = currency.Name,
- Value = currency.Id.ToString()
+ Value = currency.Id
});
}
}
@@ -87,10 +87,12 @@ namespace Grand.Web.Admin.Services
var res = await _translationService.GetTranslateResourceByName(model.Name, model.LanguageId);
if (res == null)
{
- var resource = new TranslationResource { LanguageId = model.LanguageId };
- resource.Name = model.Name;
- resource.Value = model.Value;
- resource.Area = (TranslationResourceArea)model.Area;
+ var resource = new TranslationResource {
+ LanguageId = model.LanguageId,
+ Name = model.Name,
+ Value = model.Value,
+ Area = (TranslationResourceArea)model.Area
+ };
await _translationService.InsertTranslateResource(resource);
}
else
diff --git a/src/Web/Grand.Web.Admin/Services/LogViewModelService.cs b/src/Web/Grand.Web.Admin/Services/LogViewModelService.cs
index 01f034501..36e0dfabb 100644
--- a/src/Web/Grand.Web.Admin/Services/LogViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/LogViewModelService.cs
@@ -13,7 +13,7 @@ using Grand.Business.Core.Extensions;
namespace Grand.Web.Admin.Services
{
- public partial class LogViewModelService: ILogViewModelService
+ public class LogViewModelService: ILogViewModelService
{
private readonly ILogger _logger;
private readonly IWorkContext _workContext;
@@ -43,13 +43,13 @@ namespace Grand.Web.Admin.Services
}
public virtual async Task<(IEnumerable<LogModel> logModels, int totalCount)> PrepareLogModel(LogListModel model, int pageIndex, int pageSize)
{
- DateTime? createdOnFromValue = (model.CreatedOnFrom == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.CreatedOnFrom.Value, _dateTimeService.CurrentTimeZone);
+ DateTime? createdOnFromValue = model.CreatedOnFrom == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.CreatedOnFrom.Value, _dateTimeService.CurrentTimeZone);
- DateTime? createdToFromValue = (model.CreatedOnTo == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.CreatedOnTo.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
+ DateTime? createdToFromValue = model.CreatedOnTo == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.CreatedOnTo.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
- LogLevel? logLevel = model.LogLevelId > 0 ? (LogLevel?)(model.LogLevelId) : null;
+ LogLevel? logLevel = model.LogLevelId > 0 ? (LogLevel?)model.LogLevelId : null;
var logItems = await _logger.GetAllLogs(createdOnFromValue, createdToFromValue, model.Message,
@@ -78,7 +78,7 @@ namespace Grand.Web.Admin.Services
FullMessage = log.FullMessage,
IpAddress = log.IpAddress,
CustomerId = log.CustomerId,
- CustomerEmail = !String.IsNullOrEmpty(log.CustomerId) ? (await _serviceProvider.GetRequiredService<ICustomerService>().GetCustomerById(log.CustomerId))?.Email : "",
+ CustomerEmail = !string.IsNullOrEmpty(log.CustomerId) ? (await _serviceProvider.GetRequiredService<ICustomerService>().GetCustomerById(log.CustomerId))?.Email : "",
PageUrl = log.PageUrl,
ReferrerUrl = log.ReferrerUrl,
CreatedOn = _dateTimeService.ConvertToUserTime(log.CreatedOnUtc, DateTimeKind.Utc)
diff --git a/src/Web/Grand.Web.Admin/Services/MerchandiseReturnViewModelService.cs b/src/Web/Grand.Web.Admin/Services/MerchandiseReturnViewModelService.cs
index 829bf992c..752a16444 100644
--- a/src/Web/Grand.Web.Admin/Services/MerchandiseReturnViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/MerchandiseReturnViewModelService.cs
@@ -14,7 +14,7 @@ using Grand.Domain.Directory;
using Grand.Domain.Localization;
using Grand.Domain.Orders;
using Grand.Infrastructure;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Common;
using Grand.Web.Admin.Models.Orders;
@@ -23,7 +23,7 @@ using Microsoft.AspNetCore.Http;
namespace Grand.Web.Admin.Services
{
- public partial class MerchandiseReturnViewModelService : IMerchandiseReturnViewModelService
+ public class MerchandiseReturnViewModelService : IMerchandiseReturnViewModelService
{
#region Fields
@@ -102,7 +102,7 @@ namespace Grand.Web.Admin.Services
double unitPriceInclTaxInCustomerCurrency = 0;
foreach (var item in merchandiseReturn.MerchandiseReturnItems)
{
- var orderItem = order.OrderItems.Where(x => x.Id == item.OrderItemId).First();
+ var orderItem = order.OrderItems.First(x => x.Id == item.OrderItemId);
unitPriceInclTaxInCustomerCurrency += orderItem.UnitPriceInclTax * item.Quantity;
}
@@ -129,7 +129,7 @@ namespace Grand.Web.Admin.Services
if (!excludeProperties)
{
var addr = new AddressModel();
- model.PickupAddress = await PrepareAddressModel(addr, merchandiseReturn.PickupAddress, excludeProperties);
+ model.PickupAddress = await PrepareAddressModel(addr, merchandiseReturn.PickupAddress, false);
model.CustomerComments = merchandiseReturn.CustomerComments;
model.ExternalId = merchandiseReturn.ExternalId;
model.StaffNotes = merchandiseReturn.StaffNotes;
@@ -140,7 +140,7 @@ namespace Grand.Web.Admin.Services
}
public virtual async Task<(IList<MerchandiseReturnModel> merchandiseReturnModels, int totalCount)> PrepareMerchandiseReturnModel(MerchandiseReturnListModel model, int pageIndex, int pageSize)
{
- string customerId = string.Empty;
+ var customerId = string.Empty;
if (!string.IsNullOrEmpty(model.SearchCustomerEmail))
{
var customer = await _customerService.GetCustomerByEmail(model.SearchCustomerEmail.ToLowerInvariant());
@@ -149,18 +149,18 @@ namespace Grand.Web.Admin.Services
else
customerId = "00000000-0000-0000-0000-000000000000";
}
- DateTime? startDateValue = (model.StartDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
+ DateTime? startDateValue = model.StartDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
- DateTime? endDateValue = (model.EndDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone);
+ DateTime? endDateValue = model.EndDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone);
var merchandiseReturns = await _merchandiseReturnService.SearchMerchandiseReturns(model.StoreId,
customerId,
"",
_workContext.CurrentVendor?.Id,
"",
- (model.SearchMerchandiseReturnStatusId >= 0 ? (MerchandiseReturnStatus?)model.SearchMerchandiseReturnStatusId : null),
+ model.SearchMerchandiseReturnStatusId >= 0 ? (MerchandiseReturnStatus?)model.SearchMerchandiseReturnStatusId : null,
pageIndex - 1,
pageSize,
startDateValue,
@@ -215,13 +215,13 @@ namespace Grand.Web.Admin.Services
//countries
model.AvailableCountries.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Address.SelectCountry"), Value = "" });
foreach (var c in await _countryService.GetAllCountries(showHidden: true))
- model.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id.ToString(), Selected = (c.Id == model.CountryId) });
+ model.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id, Selected = c.Id == model.CountryId });
//states
- var states = !String.IsNullOrEmpty(model.CountryId) ? (await _countryService.GetCountryById(model.CountryId))?.StateProvinces : new List<StateProvince>();
+ var states = !string.IsNullOrEmpty(model.CountryId) ? (await _countryService.GetCountryById(model.CountryId))?.StateProvinces : new List<StateProvince>();
if (states.Count > 0)
{
foreach (var s in states)
- model.AvailableStates.Add(new SelectListItem { Text = s.Name, Value = s.Id.ToString(), Selected = (s.Id == model.StateProvinceId) });
+ model.AvailableStates.Add(new SelectListItem { Text = s.Name, Value = s.Id, Selected = s.Id == model.StateProvinceId });
}
//customer attribute services
await model.PrepareCustomAddressAttributes(address, _addressAttributeService, _addressAttributeParser);
@@ -253,7 +253,7 @@ namespace Grand.Web.Admin.Services
foreach (var item in merchandiseReturn.MerchandiseReturnItems)
{
- var orderItem = order.OrderItems.Where(x => x.Id == item.OrderItemId).FirstOrDefault();
+ var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == item.OrderItemId);
items.Add(new MerchandiseReturnModel.MerchandiseReturnItemModel
{
@@ -316,8 +316,8 @@ namespace Grand.Web.Admin.Services
{
Id = merchandiseReturnNote.Id,
MerchandiseReturnId = merchandiseReturn.Id,
- DownloadId = String.IsNullOrEmpty(merchandiseReturnNote.DownloadId) ? "" : merchandiseReturnNote.DownloadId,
- DownloadGuid = download != null ? download.DownloadGuid : Guid.Empty,
+ DownloadId = string.IsNullOrEmpty(merchandiseReturnNote.DownloadId) ? "" : merchandiseReturnNote.DownloadId,
+ DownloadGuid = download?.DownloadGuid ?? Guid.Empty,
DisplayToCustomer = merchandiseReturnNote.DisplayToCustomer,
Note = merchandiseReturnNote.Note,
CreatedOn = _dateTimeService.ConvertToUserTime(merchandiseReturnNote.CreatedOnUtc, DateTimeKind.Utc),
@@ -335,7 +335,7 @@ namespace Grand.Web.Admin.Services
Note = message,
DownloadId = downloadId,
MerchandiseReturnId = merchandiseReturn.Id,
- CreatedOnUtc = DateTime.UtcNow,
+ CreatedOnUtc = DateTime.UtcNow
};
await _merchandiseReturnService.InsertMerchandiseReturnNote(merchandiseReturnNote);
diff --git a/src/Web/Grand.Web.Admin/Services/NewsViewModelService.cs b/src/Web/Grand.Web.Admin/Services/NewsViewModelService.cs
index 70b7e9c56..b6c0b6ca2 100644
--- a/src/Web/Grand.Web.Admin/Services/NewsViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/NewsViewModelService.cs
@@ -10,13 +10,14 @@ using Grand.Domain.Seo;
using Grand.Web.Common.Extensions;
using Grand.SharedKernel.Extensions;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.News;
using Microsoft.Extensions.DependencyInjection;
namespace Grand.Web.Admin.Services
{
- public partial class NewsViewModelService : INewsViewModelService
+ public class NewsViewModelService : INewsViewModelService
{
#region Fields
@@ -79,7 +80,7 @@ namespace Grand.Web.Admin.Services
}
public virtual async Task<NewsItem> UpdateNewsItemModel(NewsItem newsItem, NewsItemModel model)
{
- string prevPictureId = newsItem.PictureId;
+ var prevPictureId = newsItem.PictureId;
newsItem = model.ToEntity(newsItem, _dateTimeService);
var seName = await newsItem.ValidateSeName(model.SeName, model.Title, true, _serviceProvider.GetRequiredService<SeoSettings>(), _slugService, _serviceProvider.GetRequiredService<ILanguageService>());
newsItem.SeName = seName;
@@ -90,7 +91,7 @@ namespace Grand.Web.Admin.Services
await _slugService.SaveSlug(newsItem, seName, "");
//delete an old picture (if deleted or updated)
- if (!String.IsNullOrEmpty(prevPictureId) && prevPictureId != newsItem.PictureId)
+ if (!string.IsNullOrEmpty(prevPictureId) && prevPictureId != newsItem.PictureId)
{
var prevPicture = await _pictureService.GetPictureById(prevPictureId);
if (prevPicture != null)
@@ -104,7 +105,7 @@ namespace Grand.Web.Admin.Services
public virtual async Task<(IEnumerable<NewsCommentModel> newsCommentModels, int totalCount)> PrepareNewsCommentModel(string filterByNewsItemId, int pageIndex, int pageSize)
{
IList<NewsComment> comments;
- if (!String.IsNullOrEmpty(filterByNewsItemId))
+ if (!string.IsNullOrEmpty(filterByNewsItemId))
{
//filter comments by news item
var newsItem = await _newsService.GetNewsById(filterByNewsItemId);
diff --git a/src/Web/Grand.Web.Admin/Services/OrderViewModelService.cs b/src/Web/Grand.Web.Admin/Services/OrderViewModelService.cs
index acb96d3d6..02699f27d 100644
--- a/src/Web/Grand.Web.Admin/Services/OrderViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/OrderViewModelService.cs
@@ -18,7 +18,6 @@ using Grand.Business.Core.Interfaces.Messages;
using Grand.Business.Core.Interfaces.Storage;
using Grand.Domain.Catalog;
using Grand.Domain.Common;
-using Grand.Domain.Customers;
using Grand.Domain.Directory;
using Grand.Domain.Orders;
using Grand.Domain.Payments;
@@ -26,6 +25,7 @@ using Grand.Domain.Shipping;
using Grand.Domain.Tax;
using Grand.Infrastructure;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Orders;
using Grand.Web.Common.Extensions;
@@ -37,7 +37,7 @@ using System.Net;
namespace Grand.Web.Admin.Services
{
- public partial class OrderViewModelService : IOrderViewModelService
+ public class OrderViewModelService : IOrderViewModelService
{
#region Fields
@@ -189,7 +189,7 @@ namespace Grand.Web.Admin.Services
var statuses = await _orderStatusService.GetAll();
var model = new OrderListModel
{
- AvailableOrderStatuses = statuses.Select(x => new SelectListItem() { Value = x.StatusId.ToString(), Text = x.Name }).ToList()
+ AvailableOrderStatuses = statuses.Select(x => new SelectListItem { Value = x.StatusId.ToString(), Text = x.Name }).ToList()
};
model.AvailableOrderStatuses.Insert(0, new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
if (orderStatusId.HasValue)
@@ -213,7 +213,7 @@ namespace Grand.Web.Admin.Services
//order's tags
model.AvailableOrderTags.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
- foreach (var s in (await _orderTagService.GetAllOrderTags()))
+ foreach (var s in await _orderTagService.GetAllOrderTags())
{
model.AvailableOrderTags.Add(new SelectListItem { Text = s.Name, Value = s.Id });
}
@@ -232,17 +232,17 @@ namespace Grand.Web.Admin.Services
//stores
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var s in (await _storeService.GetAllStores()).Where(x => x.Id == storeId || string.IsNullOrWhiteSpace(storeId)))
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
//vendors
model.AvailableVendors.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var v in await _vendorService.GetAllVendors(showHidden: true))
- model.AvailableVendors.Add(new SelectListItem { Text = v.Name, Value = v.Id.ToString() });
+ model.AvailableVendors.Add(new SelectListItem { Text = v.Name, Value = v.Id });
//warehouses
model.AvailableWarehouses.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var w in await _warehouseService.GetAllWarehouses())
- model.AvailableWarehouses.Add(new SelectListItem { Text = w.Name, Value = w.Id.ToString() });
+ model.AvailableWarehouses.Add(new SelectListItem { Text = w.Name, Value = w.Id });
//payment methods
model.AvailablePaymentMethods.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
@@ -252,7 +252,7 @@ namespace Grand.Web.Admin.Services
//billing countries
foreach (var c in await _countryService.GetAllCountriesForBilling(showHidden: true))
{
- model.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id.ToString() });
+ model.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id });
}
model.AvailableCountries.Insert(0, new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
@@ -268,15 +268,15 @@ namespace Grand.Web.Admin.Services
}
public virtual async Task<(IEnumerable<OrderModel> orderModels, int totalCount)> PrepareOrderModel(OrderListModel model, int pageIndex, int pageSize)
{
- DateTime? startDateValue = (model.StartDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
+ DateTime? startDateValue = model.StartDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
- DateTime? endDateValue = (model.EndDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
+ DateTime? endDateValue = model.EndDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
int? orderStatus = model.OrderStatusId > 0 ? model.OrderStatusId : null;
- PaymentStatus? paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)(model.PaymentStatusId) : null;
- ShippingStatus? shippingStatus = model.ShippingStatusId > 0 ? (ShippingStatus?)(model.ShippingStatusId) : null;
+ PaymentStatus? paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)model.PaymentStatusId : null;
+ ShippingStatus? shippingStatus = model.ShippingStatusId > 0 ? (ShippingStatus?)model.ShippingStatusId : null;
var filterByProductId = "";
@@ -334,7 +334,7 @@ namespace Grand.Web.Admin.Services
ShippingStatus = x.ShippingStatusId.GetTranslationEnum(_translationService, _workContext),
CustomerEmail = x.BillingAddress?.Email,
CustomerId = x.CustomerId,
- CustomerFullName = string.Format("{0} {1}", x.BillingAddress?.FirstName, x.BillingAddress?.LastName),
+ CustomerFullName = $"{x.BillingAddress?.FirstName} {x.BillingAddress?.LastName}",
CreatedOn = _dateTimeService.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc)
});
}
@@ -357,7 +357,7 @@ namespace Grand.Web.Admin.Services
model.OrderGuid = order.OrderGuid;
var status = await _orderStatusService.GetAll();
- model.OrderStatuses = status.Select(x => new SelectListItem() { Value = x.StatusId.ToString(), Text = x.Name }).ToList();
+ model.OrderStatuses = status.Select(x => new SelectListItem { Value = x.StatusId.ToString(), Text = x.Name }).ToList();
model.OrderStatus = status.FirstOrDefault(x => x.StatusId == order.OrderStatusId)?.Name;
var store = await _storeService.GetStoreById(order.StoreId);
@@ -399,7 +399,7 @@ namespace Grand.Web.Admin.Services
model.IsLoggedInAsVendor = _workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer);
//order's tags
- if (order != null && order.OrderTags.Any())
+ if (order.OrderTags.Any())
{
var tagsName = new List<string>();
foreach (var item in order.OrderTags)
@@ -413,10 +413,7 @@ namespace Grand.Web.Admin.Services
#region Order totals
- var primaryStoreCurrency = await _currencyService.GetCurrencyByCode(order.PrimaryCurrencyCode);
-
- if (primaryStoreCurrency == null)
- primaryStoreCurrency = await _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId);
+ var primaryStoreCurrency = await _currencyService.GetCurrencyByCode(order.PrimaryCurrencyCode) ?? await _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId);
if (primaryStoreCurrency == null)
throw new Exception("Cannot load primary store currency");
@@ -431,8 +428,8 @@ namespace Grand.Web.Admin.Services
model.OrderSubtotalInclTaxValue = order.OrderSubtotalInclTax;
model.OrderSubtotalExclTaxValue = order.OrderSubtotalExclTax;
//discount (applied to order subtotal)
- string orderSubtotalDiscountInclTaxStr = _priceFormatter.FormatPrice(order.OrderSubTotalDiscountInclTax, orderCurrency, _workContext.WorkingLanguage, true);
- string orderSubtotalDiscountExclTaxStr = _priceFormatter.FormatPrice(order.OrderSubTotalDiscountExclTax, orderCurrency, _workContext.WorkingLanguage, false);
+ var orderSubtotalDiscountInclTaxStr = _priceFormatter.FormatPrice(order.OrderSubTotalDiscountInclTax, orderCurrency, _workContext.WorkingLanguage, true);
+ var orderSubtotalDiscountExclTaxStr = _priceFormatter.FormatPrice(order.OrderSubTotalDiscountExclTax, orderCurrency, _workContext.WorkingLanguage, false);
if (order.OrderSubTotalDiscountInclTax > 0)
model.OrderSubTotalDiscountInclTax = orderSubtotalDiscountInclTaxStr;
if (order.OrderSubTotalDiscountExclTax > 0)
@@ -457,14 +454,14 @@ namespace Grand.Web.Admin.Services
//tax
model.Tax = await _priceFormatter.FormatPrice(order.OrderTax, order.CustomerCurrencyCode, false, _workContext.WorkingLanguage);
- bool displayTaxRates = _taxSettings.DisplayTaxRates && order.OrderTaxes.Any();
- bool displayTax = !displayTaxRates;
+ var displayTaxRates = _taxSettings.DisplayTaxRates && order.OrderTaxes.Any();
+ var displayTax = !displayTaxRates;
foreach (var tr in order.OrderTaxes)
{
model.TaxRates.Add(new OrderModel.TaxRate
{
Rate = _priceFormatter.FormatTaxRate(tr.Percent),
- Value = await _priceFormatter.FormatPrice(tr.Amount, order.CustomerCurrencyCode, false, _workContext.WorkingLanguage),
+ Value = await _priceFormatter.FormatPrice(tr.Amount, order.CustomerCurrencyCode, false, _workContext.WorkingLanguage)
});
}
model.DisplayTaxRates = displayTaxRates;
@@ -486,7 +483,7 @@ namespace Grand.Web.Admin.Services
model.GiftVouchers.Add(new OrderModel.GiftVoucher
{
CouponCode = giftVoucher.Code,
- Amount = await _priceFormatter.FormatPrice(-gcuh.UsedValue, order.CustomerCurrencyCode, false, _workContext.WorkingLanguage),
+ Amount = await _priceFormatter.FormatPrice(-gcuh.UsedValue, order.CustomerCurrencyCode, false, _workContext.WorkingLanguage)
});
}
}
@@ -522,7 +519,7 @@ namespace Grand.Web.Admin.Services
model.UsedDiscounts.Add(new OrderModel.UsedDiscountModel
{
DiscountId = d.DiscountId,
- DiscountName = discount.Name,
+ DiscountName = discount.Name
});
}
}
@@ -533,7 +530,7 @@ namespace Grand.Web.Admin.Services
var productCost = order.OrderItems.Sum(orderItem => orderItem.OriginalProductCost * orderItem.Quantity);
if (order.CurrencyRate > 0)
{
- var profit = Convert.ToDouble((order.OrderTotal / order.CurrencyRate) - (order.OrderShippingExclTax / order.CurrencyRate) - (order.OrderTax / order.CurrencyRate) - productCost);
+ var profit = Convert.ToDouble(order.OrderTotal / order.CurrencyRate - order.OrderShippingExclTax / order.CurrencyRate - order.OrderTax / order.CurrencyRate - productCost);
model.Profit = await _priceFormatter.FormatPrice(profit, order.PrimaryCurrencyCode, false, _workContext.WorkingLanguage);
}
}
@@ -655,20 +652,18 @@ namespace Grand.Web.Admin.Services
model.ShippingAddress.FaxRequired = _addressSettings.FaxRequired;
model.ShippingAddress.NoteEnabled = _addressSettings.NoteEnabled;
- model.ShippingAddressGoogleMapsUrl = string.Format("http://maps.google.com/maps?f=q&hl=en&ie=UTF8&oe=UTF8&geocode=&q={0}", WebUtility.UrlEncode(order.ShippingAddress.Address1 + " " + order.ShippingAddress.ZipPostalCode + " " + order.ShippingAddress.City + " " + (!String.IsNullOrEmpty(order.ShippingAddress.CountryId) ? (await _countryService.GetCountryById(order.ShippingAddress.CountryId))?.Name : "")));
+ model.ShippingAddressGoogleMapsUrl =
+ $"http://maps.google.com/maps?f=q&hl=en&ie=UTF8&oe=UTF8&geocode=&q={WebUtility.UrlEncode(order.ShippingAddress.Address1 + " " + order.ShippingAddress.ZipPostalCode + " " + order.ShippingAddress.City + " " + (!string.IsNullOrEmpty(order.ShippingAddress.CountryId) ? (await _countryService.GetCountryById(order.ShippingAddress.CountryId))?.Name : ""))}";
}
}
else
{
- if (order.PickupPoint != null)
+ if (order.PickupPoint is { Address: not null })
{
- if (order.PickupPoint.Address != null)
- {
- model.PickupAddress = await order.PickupPoint.Address.ToModel(_countryService);
- var country = await _countryService.GetCountryById(order.PickupPoint.Address.CountryId);
- if (country != null)
- model.PickupAddress.CountryName = country.Name;
- }
+ model.PickupAddress = await order.PickupPoint.Address.ToModel(_countryService);
+ var country = await _countryService.GetCountryById(order.PickupPoint.Address.CountryId);
+ if (country != null)
+ model.PickupAddress.CountryName = country.Name;
}
}
model.ShippingMethod = order.ShippingMethod;
@@ -694,7 +689,7 @@ namespace Grand.Web.Admin.Services
#region Products
model.CheckoutAttributeInfo = order.CheckoutAttributeDescription;
- bool hasDownloadableItems = false;
+ var hasDownloadableItems = false;
var products = order.OrderItems;
//a vendor should have access only to his products
if (_workContext.CurrentVendor != null && !await _groupService.IsStaff(_workContext.CurrentCustomer))
@@ -727,11 +722,11 @@ namespace Grand.Web.Admin.Services
IsDownload = product.IsDownload,
DownloadCount = orderItem.DownloadCount,
DownloadActivationType = product.DownloadActivationTypeId,
- IsDownloadActivated = orderItem.IsDownloadActivated,
+ IsDownloadActivated = orderItem.IsDownloadActivated
};
//picture
var orderItemPicture = await product.GetProductPicture(orderItem.Attributes, _productService, _pictureService);
- orderItemModel.PictureThumbnailUrl = await _pictureService.GetPictureUrl(orderItemPicture, 75, true);
+ orderItemModel.PictureThumbnailUrl = await _pictureService.GetPictureUrl(orderItemPicture, 75);
//license file
if (!string.IsNullOrEmpty(orderItem.LicenseDownloadId))
@@ -802,11 +797,11 @@ namespace Grand.Web.Admin.Services
var model = new OrderModel.AddOrderProductModel
{
OrderId = order.Id,
- OrderNumber = order.OrderNumber
+ OrderNumber = order.OrderNumber,
+ //product types
+ AvailableProductTypes = ProductType.SimpleProduct.ToSelectList(_translationService, _workContext, false).ToList()
};
- //product types
- model.AvailableProductTypes = ProductType.SimpleProduct.ToSelectList(_translationService, _workContext, false).ToList();
model.AvailableProductTypes.Insert(0, new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "0" });
return await Task.FromResult(model);
@@ -823,8 +818,8 @@ namespace Grand.Web.Admin.Services
var presetQty = 1;
var presetPrice = (await _pricingService.GetFinalPrice(product, customer, currency, 0, true, presetQty)).finalPrice;
var productPrice = await _taxService.GetProductPrice(product, presetPrice, true, customer);
- double presetPriceInclTax = productPrice.productprice;
- double presetPriceExclTax = (await _taxService.GetProductPrice(product, presetPrice, false, customer)).productprice;
+ var presetPriceInclTax = productPrice.productprice;
+ var presetPriceExclTax = (await _taxService.GetProductPrice(product, presetPrice, false, customer)).productprice;
var model = new OrderModel.AddOrderProductModel.ProductDetailsModel
{
@@ -919,13 +914,13 @@ namespace Grand.Web.Admin.Services
//countries
model.Address.AvailableCountries.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Address.SelectCountry"), Value = "" });
foreach (var c in await _countryService.GetAllCountries(showHidden: true))
- model.Address.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id.ToString(), Selected = (c.Id == address.CountryId) });
+ model.Address.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id, Selected = c.Id == address.CountryId });
//states
- var states = !String.IsNullOrEmpty(address.CountryId) ? (await _countryService.GetCountryById(address.CountryId))?.StateProvinces : new List<StateProvince>();
- if (states.Count > 0)
+ var states = !string.IsNullOrEmpty(address.CountryId) ? (await _countryService.GetCountryById(address.CountryId))?.StateProvinces : new List<StateProvince>();
+ if (states?.Count > 0)
{
foreach (var s in states)
- model.Address.AvailableStates.Add(new SelectListItem { Text = s.Name, Value = s.Id.ToString(), Selected = (s.Id == address.StateProvinceId) });
+ model.Address.AvailableStates.Add(new SelectListItem { Text = s.Name, Value = s.Id, Selected = s.Id == address.StateProvinceId });
}
//customer attribute services
@@ -946,8 +941,8 @@ namespace Grand.Web.Admin.Services
{
Id = orderNote.Id,
OrderId = order.Id,
- DownloadId = String.IsNullOrEmpty(orderNote.DownloadId) ? "" : orderNote.DownloadId,
- DownloadGuid = download != null ? download.DownloadGuid : Guid.Empty,
+ DownloadId = string.IsNullOrEmpty(orderNote.DownloadId) ? "" : orderNote.DownloadId,
+ DownloadGuid = download?.DownloadGuid ?? Guid.Empty,
DisplayToCustomer = orderNote.DisplayToCustomer,
Note = orderNote.Note,
CreatedOn = _dateTimeService.ConvertToUserTime(orderNote.CreatedOnUtc, DateTimeKind.Utc),
@@ -965,7 +960,7 @@ namespace Grand.Web.Admin.Services
Note = message,
DownloadId = downloadId,
OrderId = order.Id,
- CreatedOnUtc = DateTime.UtcNow,
+ CreatedOnUtc = DateTime.UtcNow
};
await _orderService.InsertOrderNote(orderNote);
@@ -1015,7 +1010,7 @@ namespace Grand.Web.Admin.Services
Note = "Address has been edited",
DisplayToCustomer = false,
CreatedOnUtc = DateTime.UtcNow,
- OrderId = order.Id,
+ OrderId = order.Id
});
_ = LogEditOrder(order.Id);
return address;
@@ -1028,10 +1023,10 @@ namespace Grand.Web.Admin.Services
//save order item
//basic properties
- double.TryParse(form["UnitPriceInclTax"], out double unitPriceInclTax);
- double.TryParse(form["UnitPriceExclTax"], out double unitPriceExclTax);
- int.TryParse(form["Quantity"], out int quantity);
- int.TryParse(form["TaxRate"], out int taxRate);
+ double.TryParse(form["UnitPriceInclTax"], out var unitPriceInclTax);
+ double.TryParse(form["UnitPriceExclTax"], out var unitPriceExclTax);
+ int.TryParse(form["Quantity"], out var quantity);
+ int.TryParse(form["TaxRate"], out var taxRate);
//attributes
//warnings
@@ -1043,7 +1038,7 @@ namespace Grand.Web.Admin.Services
var attributes = product.ProductAttributeMappings;
foreach (var attribute in attributes)
{
- string controlId = string.Format("product_attribute_{0}", attribute.Id);
+ var controlId = $"product_attribute_{attribute.Id}";
switch (attribute.AttributeControlTypeId)
{
case AttributeControlType.DropdownList:
@@ -1082,7 +1077,7 @@ namespace Grand.Web.Admin.Services
.ToList())
{
customattributes = Domain.Catalog.ProductExtensions.AddProductAttribute(customattributes,
- attribute, selectedAttributeId.ToString()).ToList();
+ attribute, selectedAttributeId).ToList();
}
}
break;
@@ -1090,9 +1085,9 @@ namespace Grand.Web.Admin.Services
case AttributeControlType.MultilineTextbox:
{
form.TryGetValue(controlId, out var ctrlAttributes);
- if (!String.IsNullOrEmpty(ctrlAttributes))
+ if (!string.IsNullOrEmpty(ctrlAttributes))
{
- string enteredText = ctrlAttributes.ToString().Trim();
+ var enteredText = ctrlAttributes.ToString().Trim();
customattributes = Domain.Catalog.ProductExtensions.AddProductAttribute(customattributes,
attribute, enteredText).ToList();
}
@@ -1106,7 +1101,7 @@ namespace Grand.Web.Admin.Services
DateTime? selectedDate = null;
try
{
- selectedDate = new DateTime(Int32.Parse(year), Int32.Parse(month), Int32.Parse(day));
+ selectedDate = new DateTime(int.Parse(year), int.Parse(month), int.Parse(day));
}
catch { }
if (selectedDate.HasValue)
@@ -1128,8 +1123,6 @@ namespace Grand.Web.Admin.Services
}
}
break;
- default:
- break;
}
}
//validate conditional attributes (if specified)
@@ -1146,14 +1139,14 @@ namespace Grand.Web.Admin.Services
#region Gift vouchers
- string recipientName = "";
- string recipientEmail = "";
- string senderName = "";
- string senderEmail = "";
- string giftVoucherMessage = "";
+ var recipientName = "";
+ var recipientEmail = "";
+ var senderName = "";
+ var senderEmail = "";
+ var giftVoucherMessage = "";
if (product.IsGiftVoucher)
{
- foreach (string formKey in form.Keys)
+ foreach (var formKey in form.Keys)
{
if (formKey.Equals("giftvoucher.RecipientName", StringComparison.OrdinalIgnoreCase))
{
@@ -1178,7 +1171,6 @@ namespace Grand.Web.Admin.Services
if (formKey.Equals("giftvoucher.Message", StringComparison.OrdinalIgnoreCase))
{
giftVoucherMessage = form[formKey];
- continue;
}
}
customattributes = GiftVoucherExtensions.AddGiftVoucherAttribute(customattributes,
@@ -1188,10 +1180,7 @@ namespace Grand.Web.Admin.Services
#endregion
//warnings
- var shoppingCartService = _serviceProvider.GetRequiredService<IShoppingCartService>();
- var inventoryManageService = _serviceProvider.GetRequiredService<IInventoryManageService>();
-
- var shoppingCartItem = new ShoppingCartItem() {
+ var shoppingCartItem = new ShoppingCartItem {
ShoppingCartTypeId = ShoppingCartType.ShoppingCart,
Quantity = quantity,
WarehouseId = product.WarehouseId,
@@ -1205,7 +1194,7 @@ namespace Grand.Web.Admin.Services
//no errors
var productAttributeFormatter = _serviceProvider.GetRequiredService<IProductAttributeFormatter>();
//attributes
- string attributeDescription = await productAttributeFormatter.FormatAttributes(product, customattributes, customer);
+ var attributeDescription = await productAttributeFormatter.FormatAttributes(product, customattributes, customer);
//save item
var orderItem = new OrderItem
@@ -1232,10 +1221,10 @@ namespace Grand.Web.Admin.Services
IsDownloadActivated = false,
LicenseDownloadId = "",
IsShipEnabled = product.IsShipEnabled,
- CreatedOnUtc = DateTime.UtcNow,
+ CreatedOnUtc = DateTime.UtcNow
};
- await _mediator.Send(new InsertOrderItemCommand() { Order = order, OrderItem = orderItem, Product = product });
+ await _mediator.Send(new InsertOrderItemCommand { Order = order, OrderItem = orderItem, Product = product });
_ = LogEditOrder(order.Id);
@@ -1245,15 +1234,15 @@ namespace Grand.Web.Admin.Services
public virtual async Task<IList<Order>> PrepareOrders(OrderListModel model)
{
- DateTime? startDateValue = (model.StartDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
+ DateTime? startDateValue = model.StartDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
- DateTime? endDateValue = (model.EndDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
+ DateTime? endDateValue = model.EndDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
int? orderStatus = model.OrderStatusId > 0 ? model.OrderStatusId : null;
- PaymentStatus? paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)(model.PaymentStatusId) : null;
- ShippingStatus? shippingStatus = model.ShippingStatusId > 0 ? (ShippingStatus?)(model.ShippingStatusId) : null;
+ PaymentStatus? paymentStatus = model.PaymentStatusId > 0 ? (PaymentStatus?)model.PaymentStatusId : null;
+ ShippingStatus? shippingStatus = model.ShippingStatusId > 0 ? (ShippingStatus?)model.ShippingStatusId : null;
var filterByProductId = "";
var product = await _productService.GetProductById(model.ProductId);
diff --git a/src/Web/Grand.Web.Admin/Services/PageViewModelService.cs b/src/Web/Grand.Web.Admin/Services/PageViewModelService.cs
index b48207750..c801a8aeb 100644
--- a/src/Web/Grand.Web.Admin/Services/PageViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/PageViewModelService.cs
@@ -12,11 +12,12 @@ using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Pages;
using Microsoft.AspNetCore.Mvc.Rendering;
using Grand.Infrastructure;
+using Grand.Web.Admin.Extensions.Mapping;
using Microsoft.AspNetCore.Http;
namespace Grand.Web.Admin.Services
{
- public partial class PageViewModelService : IPageViewModelService
+ public class PageViewModelService : IPageViewModelService
{
private readonly IPageLayoutService _pageLayoutService;
private readonly IPageService _pageService;
@@ -62,7 +63,7 @@ namespace Grand.Web.Admin.Services
//stores
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" });
foreach (var s in await _storeService.GetAllStores())
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
return model;
}
diff --git a/src/Web/Grand.Web.Admin/Services/PictureViewModelService.cs b/src/Web/Grand.Web.Admin/Services/PictureViewModelService.cs
index fe45fd0c5..e492741d3 100644
--- a/src/Web/Grand.Web.Admin/Services/PictureViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/PictureViewModelService.cs
@@ -33,7 +33,7 @@ namespace Grand.Web.Admin.Services
var model = new PictureModel {
Id = picture.Id,
ObjectId = objectId,
- PictureUrl = picture != null ? await _pictureService.GetPictureUrl(picture) : null,
+ PictureUrl = await _pictureService.GetPictureUrl(picture),
AltAttribute = picture?.AltAttribute,
TitleAttribute = picture?.TitleAttribute,
Style = picture?.Style,
diff --git a/src/Web/Grand.Web.Admin/Services/ProductReviewViewModelService.cs b/src/Web/Grand.Web.Admin/Services/ProductReviewViewModelService.cs
index c08038d45..ca8dd7fec 100644
--- a/src/Web/Grand.Web.Admin/Services/ProductReviewViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/ProductReviewViewModelService.cs
@@ -8,7 +8,7 @@ using Grand.Business.Core.Interfaces.Customers;
using Grand.Domain.Catalog;
using Grand.Web.Common.Extensions;
using Grand.SharedKernel.Extensions;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Catalog;
using MediatR;
@@ -16,7 +16,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Services
{
- public partial class ProductReviewViewModelService : IProductReviewViewModelService
+ public class ProductReviewViewModelService : IProductReviewViewModelService
{
private readonly IProductService _productService;
private readonly IProductReviewService _productReviewService;
@@ -86,7 +86,7 @@ namespace Grand.Web.Admin.Services
var model = new ProductReviewListModel();
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" });
- var stores = (await _storeService.GetAllStores()).Where(x => x.Id == storeId || string.IsNullOrWhiteSpace(storeId)).Select(st => new SelectListItem() { Text = st.Shortcut, Value = st.Id.ToString() });
+ var stores = (await _storeService.GetAllStores()).Where(x => x.Id == storeId || string.IsNullOrWhiteSpace(storeId)).Select(st => new SelectListItem { Text = st.Shortcut, Value = st.Id.ToString() });
foreach (var selectListItem in stores)
model.AvailableStores.Add(selectListItem);
return model;
@@ -94,11 +94,11 @@ namespace Grand.Web.Admin.Services
public virtual async Task<(IEnumerable<ProductReviewModel> productReviewModels, int totalCount)> PrepareProductReviewsModel(ProductReviewListModel model, int pageIndex, int pageSize)
{
- DateTime? createdOnFromValue = (model.CreatedOnFrom == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.CreatedOnFrom.Value, _dateTimeService.CurrentTimeZone);
+ DateTime? createdOnFromValue = model.CreatedOnFrom == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.CreatedOnFrom.Value, _dateTimeService.CurrentTimeZone);
- DateTime? createdToFromValue = (model.CreatedOnTo == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.CreatedOnTo.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
+ DateTime? createdToFromValue = model.CreatedOnTo == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.CreatedOnTo.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
var productReviews = await _productReviewService.GetAllProductReviews("", null,
createdOnFromValue, createdToFromValue, model.SearchText, model.SearchStoreId, model.SearchProductId);
@@ -122,7 +122,7 @@ namespace Grand.Web.Admin.Services
var product = await _productService.GetProductById(productReview.ProductId);
//update product totals
- await _mediator.Send(new UpdateProductReviewTotalsCommand() { Product = product });
+ await _mediator.Send(new UpdateProductReviewTotalsCommand { Product = product });
return productReview;
}
@@ -133,15 +133,15 @@ namespace Grand.Web.Admin.Services
var product = await _productService.GetProductById(productReview.ProductId);
//update product totals
- await _mediator.Send(new UpdateProductReviewTotalsCommand() { Product = product });
+ await _mediator.Send(new UpdateProductReviewTotalsCommand { Product = product });
}
- public virtual async Task ApproveSelected(IList<string> selectedIds, string storeId)
+ public virtual async Task ApproveSelected(IEnumerable<string> selectedIds, string storeId)
{
foreach (var id in selectedIds)
{
- string idReview = id.Split(':').First().ToString();
- string idProduct = id.Split(':').Last().ToString();
+ var idReview = id.Split(':').First();
+ var idProduct = id.Split(':').Last();
var product = await _productService.GetProductById(idProduct);
var productReview = await _productReviewService.GetProductReviewById(idReview);
if (productReview != null && (string.IsNullOrEmpty(storeId) || productReview.StoreId == storeId))
@@ -150,7 +150,7 @@ namespace Grand.Web.Admin.Services
productReview.IsApproved = true;
await _productReviewService.UpdateProductReview(productReview);
//update product totals
- await _mediator.Send(new UpdateProductReviewTotalsCommand() { Product = product });
+ await _mediator.Send(new UpdateProductReviewTotalsCommand { Product = product });
//raise event (only if it wasn't approved before)
@@ -160,12 +160,12 @@ namespace Grand.Web.Admin.Services
}
}
- public virtual async Task DisapproveSelected(IList<string> selectedIds, string storeId)
+ public virtual async Task DisapproveSelected(IEnumerable<string> selectedIds, string storeId)
{
foreach (var id in selectedIds)
{
- string idReview = id.Split(':').First().ToString();
- string idProduct = id.Split(':').Last().ToString();
+ var idReview = id.Split(':').First();
+ var idProduct = id.Split(':').Last();
var product = await _productService.GetProductById(idProduct);
var productReview = await _productReviewService.GetProductReviewById(idReview);
@@ -174,7 +174,7 @@ namespace Grand.Web.Admin.Services
productReview.IsApproved = false;
await _productReviewService.UpdateProductReview(productReview);
//update product totals
- await _mediator.Send(new UpdateProductReviewTotalsCommand() { Product = product });
+ await _mediator.Send(new UpdateProductReviewTotalsCommand { Product = product });
}
}
}
diff --git a/src/Web/Grand.Web.Admin/Services/ProductViewModelService.cs b/src/Web/Grand.Web.Admin/Services/ProductViewModelService.cs
index 5adaf3ca7..af2d2e6f2 100644
--- a/src/Web/Grand.Web.Admin/Services/ProductViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/ProductViewModelService.cs
@@ -26,6 +26,7 @@ using Grand.Domain.Tax;
using Grand.Infrastructure;
using Grand.SharedKernel.Extensions;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Catalog;
using Grand.Web.Common.Extensions;
@@ -35,7 +36,7 @@ using Microsoft.Extensions.DependencyInjection;
namespace Grand.Web.Admin.Services
{
- public partial class ProductViewModelService : IProductViewModelService
+ public class ProductViewModelService : IProductViewModelService
{
private readonly IProductService _productService;
private readonly IInventoryManageService _inventoryManageService;
@@ -226,7 +227,7 @@ namespace Grand.Web.Admin.Services
productTag = new ProductTag {
Name = productTagName,
SeName = SeoExtensions.GetSeName(productTagName, seoSettings.ConvertNonWesternChars, seoSettings.AllowUnicodeCharsInUrls, seoSettings.SeoCharConversion),
- Count = 0,
+ Count = 0
};
await _productTagService.InsertProductTag(productTag);
}
@@ -253,12 +254,12 @@ namespace Grand.Web.Admin.Services
//stores
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var s in (await _storeService.GetAllStores()).Where(x => x.Id == storeId || string.IsNullOrWhiteSpace(storeId)))
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
//vendors
model.AvailableVendors.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var v in await _vendorService.GetAllVendors(showHidden: true))
- model.AvailableVendors.Add(new SelectListItem { Text = v.Name, Value = v.Id.ToString() });
+ model.AvailableVendors.Add(new SelectListItem { Text = v.Name, Value = v.Id });
//product types
model.AvailableProductTypes = ProductType.SimpleProduct.ToSelectList(_translationService, _workContext, false).ToList();
@@ -304,7 +305,7 @@ namespace Grand.Web.Admin.Services
var attributeValueModel = new ProductAttributeCombinationModel.ProductAttributeValueModel {
Id = attributeValue.Id,
Name = attributeValue.Name,
- IsPreSelected = attributeValue.IsPreSelected,
+ IsPreSelected = attributeValue.IsPreSelected
};
attributeModel.Values.Add(attributeValueModel);
}
@@ -341,12 +342,12 @@ namespace Grand.Web.Admin.Services
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var store in (await _storeService.GetAllStores()).Where(x => x.Id == storeId || string.IsNullOrWhiteSpace(storeId)))
- model.AvailableStores.Add(new SelectListItem { Text = store.Shortcut, Value = store.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = store.Shortcut, Value = store.Id });
//customer groups
model.AvailableCustomerGroups.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var role in await _groupService.GetAllCustomerGroups(showHidden: true))
- model.AvailableCustomerGroups.Add(new SelectListItem { Text = role.Name, Value = role.Id.ToString() });
+ model.AvailableCustomerGroups.Add(new SelectListItem { Text = role.Name, Value = role.Id });
foreach (var currency in await _currencyService.GetAllCurrencies())
model.AvailableCurrencies.Add(new SelectListItem { Text = currency.Name, Value = currency.CurrencyCode });
@@ -457,8 +458,6 @@ namespace Grand.Web.Admin.Services
model.BaseWeightIn = (await _measureService.GetMeasureWeightById(_measureSettings.BaseWeightId))?.Name;
model.BaseDimensionIn = (await _measureService.GetMeasureDimensionById(_measureSettings.BaseDimensionId))?.Name;
- var storeId = _workContext.CurrentCustomer.StaffStoreId;
-
if (product != null)
{
//date
@@ -485,7 +484,7 @@ namespace Grand.Web.Admin.Services
{
model.AvailableProductAttributes.Add(new SelectListItem {
Text = productAttribute.Name,
- Value = productAttribute.Id.ToString()
+ Value = productAttribute.Id
});
}
}
@@ -522,7 +521,7 @@ namespace Grand.Web.Admin.Services
{
model.AvailableDeliveryDates.Add(new SelectListItem {
Text = deliveryDate.Name,
- Value = deliveryDate.Id.ToString()
+ Value = deliveryDate.Id
});
}
@@ -536,7 +535,7 @@ namespace Grand.Web.Admin.Services
{
model.AvailableWarehouses.Add(new SelectListItem {
Text = warehouse.Name,
- Value = warehouse.Id.ToString()
+ Value = warehouse.Id
});
}
@@ -583,20 +582,20 @@ namespace Grand.Web.Admin.Services
var taxCategories = await _taxCategoryService.GetAllTaxCategories();
model.AvailableTaxCategories.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Configuration.Tax.Settings.TaxCategories.None"), Value = "" });
foreach (var tc in taxCategories)
- model.AvailableTaxCategories.Add(new SelectListItem { Text = tc.Name, Value = tc.Id.ToString(), Selected = product != null && !setPredefinedValues && tc.Id == product.TaxCategoryId });
+ model.AvailableTaxCategories.Add(new SelectListItem { Text = tc.Name, Value = tc.Id, Selected = product != null && !setPredefinedValues && tc.Id == product.TaxCategoryId });
//baseprice units
var measureWeights = await _measureService.GetAllMeasureWeights();
foreach (var mw in measureWeights)
- model.AvailableBasepriceUnits.Add(new SelectListItem { Text = mw.Name, Value = mw.Id.ToString(), Selected = product != null && !setPredefinedValues && mw.Id == product.BasepriceUnitId });
+ model.AvailableBasepriceUnits.Add(new SelectListItem { Text = mw.Name, Value = mw.Id, Selected = product != null && !setPredefinedValues && mw.Id == product.BasepriceUnitId });
foreach (var mw in measureWeights)
- model.AvailableBasepriceBaseUnits.Add(new SelectListItem { Text = mw.Name, Value = mw.Id.ToString(), Selected = product != null && !setPredefinedValues && mw.Id == product.BasepriceBaseUnitId });
+ model.AvailableBasepriceBaseUnits.Add(new SelectListItem { Text = mw.Name, Value = mw.Id, Selected = product != null && !setPredefinedValues && mw.Id == product.BasepriceBaseUnitId });
//units
var units = await _measureService.GetAllMeasureUnits();
model.AvailableUnits.Add(new SelectListItem { Text = "---", Value = "" });
foreach (var un in units)
- model.AvailableUnits.Add(new SelectListItem { Text = un.Name, Value = un.Id.ToString(), Selected = product != null && un.Id == product.UnitId });
+ model.AvailableUnits.Add(new SelectListItem { Text = un.Name, Value = un.Id, Selected = product != null && un.Id == product.UnitId });
//discounts
model.AvailableDiscounts = (await _discountService
@@ -628,7 +627,7 @@ namespace Grand.Web.Admin.Services
}
if (_workContext.CurrentVendor != null && !string.IsNullOrEmpty(_workContext.CurrentVendor.StoreId))
{
- model.Stores = new string[] { _workContext.CurrentVendor.StoreId };
+ model.Stores = new[] { _workContext.CurrentVendor.StoreId };
}
}
@@ -737,15 +736,15 @@ namespace Grand.Web.Admin.Services
if (_workContext.CurrentVendor != null && !string.IsNullOrEmpty(_workContext.CurrentVendor.StoreId))
{
if (s.Id == _workContext.CurrentVendor.StoreId)
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
}
else
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
}
//warehouses
model.AvailableWarehouses.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = " " });
foreach (var wh in await _warehouseService.GetAllWarehouses())
- model.AvailableWarehouses.Add(new SelectListItem { Text = wh.Name, Value = wh.Id.ToString() });
+ model.AvailableWarehouses.Add(new SelectListItem { Text = wh.Name, Value = wh.Id });
//product types
model.AvailableProductTypes = ProductType.SimpleProduct.ToSelectList(_translationService, _workContext, false).ToList();
@@ -798,7 +797,7 @@ namespace Grand.Web.Admin.Services
if (model.SearchPublishedId == 3)
showOnHomePage = true;
- bool markedAsNewOnly = false;
+ var markedAsNewOnly = false;
if (model.SearchPublishedId == 4)
markedAsNewOnly = true;
@@ -828,13 +827,11 @@ namespace Grand.Web.Admin.Services
productModel.FullDescription = "";
//picture
- var defaultProductPicture = x.ProductPictures.FirstOrDefault();
- if (defaultProductPicture == null)
- defaultProductPicture = new ProductPicture();
- productModel.PictureThumbnailUrl = await _pictureService.GetPictureUrl(defaultProductPicture.PictureId, 100, true);
+ var defaultProductPicture = x.ProductPictures.FirstOrDefault() ?? new ProductPicture();
+ productModel.PictureThumbnailUrl = await _pictureService.GetPictureUrl(defaultProductPicture.PictureId, 100);
//product type
productModel.ProductTypeName = x.ProductTypeId.GetTranslationEnum(_translationService, _workContext);
- //friendly stock qantity
+ //friendly stock quantity
//if a simple product AND "manage inventory" is "Track inventory", then display
if (x.ProductTypeId == ProductType.SimpleProduct && x.ManageInventoryMethodId == ManageInventoryMethod.ManageStock)
productModel.StockQuantityStr = _stockQuantityService.GetTotalStockQuantity(x, total: true).ToString();
@@ -892,13 +889,13 @@ namespace Grand.Web.Admin.Services
model.VendorId = _workContext.CurrentVendor.Id;
if (!string.IsNullOrEmpty(_workContext.CurrentVendor.StoreId))
{
- model.Stores = new string[] { _workContext.CurrentVendor.StoreId };
+ model.Stores = new[] { _workContext.CurrentVendor.StoreId };
}
}
//a staff should have access only to his products
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
- model.Stores = new string[] { _workContext.CurrentCustomer.StaffStoreId };
+ model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };
}
//vendors cannot edit "Show on home page" property
@@ -952,7 +949,7 @@ namespace Grand.Web.Admin.Services
model.VendorId = _workContext.CurrentVendor.Id;
if (!string.IsNullOrEmpty(_workContext.CurrentVendor.StoreId))
{
- model.Stores = new string[] { _workContext.CurrentVendor.StoreId };
+ model.Stores = new[] { _workContext.CurrentVendor.StoreId };
}
}
//vendors cannot edit "Show on home page" property
@@ -969,11 +966,11 @@ namespace Grand.Web.Admin.Services
//a staff should have access only to his products
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
- model.Stores = new string[] { _workContext.CurrentCustomer.StaffStoreId };
+ model.Stores = new[] { _workContext.CurrentCustomer.StaffStoreId };
}
var prevStockQuantity = _stockQuantityService.GetTotalStockQuantity(product, total: true);
- var prevMultiWarehouseStock = product.ProductWarehouseInventory.Select(i => new ProductWarehouseInventory() { WarehouseId = i.WarehouseId, StockQuantity = i.StockQuantity, ReservedQuantity = i.ReservedQuantity }).ToList();
+ var prevMultiWarehouseStock = product.ProductWarehouseInventory.Select(i => new ProductWarehouseInventory { WarehouseId = i.WarehouseId, StockQuantity = i.StockQuantity, ReservedQuantity = i.ReservedQuantity }).ToList();
var prevDownloadId = product.DownloadId;
var prevSampleDownloadId = product.SampleDownloadId;
@@ -1065,7 +1062,7 @@ namespace Grand.Web.Admin.Services
_workContext.CurrentCustomer, _httpContextAccessor.HttpContext?.Connection?.RemoteIpAddress?.ToString(),
_translationService.GetResource("ActivityLog.DeleteProduct"), product.Name);
}
- public virtual async Task DeleteSelected(IList<string> selectedIds)
+ public virtual async Task DeleteSelected(IEnumerable<string> selectedIds)
{
var products = new List<Product>();
products.AddRange(await _productService.GetProductsByIds(selectedIds.ToArray(), true));
@@ -1133,11 +1130,11 @@ namespace Grand.Web.Admin.Services
}
}
- if (product.ProductCategories.Where(x => x.CategoryId == model.CategoryId).Count() == 0)
+ if (!product.ProductCategories.Any(x => x.CategoryId == model.CategoryId))
{
var productCategory = new ProductCategory {
CategoryId = model.CategoryId,
- DisplayOrder = model.DisplayOrder,
+ DisplayOrder = model.DisplayOrder
};
//a vendor cannot edit "IsFeaturedProduct" property
if (_workContext.CurrentVendor == null)
@@ -1150,11 +1147,11 @@ namespace Grand.Web.Admin.Services
public virtual async Task UpdateProductCategoryModel(ProductModel.ProductCategoryModel model)
{
var product = await _productService.GetProductById(model.ProductId, true);
- var productCategory = product.ProductCategories.Where(x => x.Id == model.Id).FirstOrDefault();
+ var productCategory = product.ProductCategories.FirstOrDefault(x => x.Id == model.Id);
if (productCategory == null)
throw new ArgumentException("No product category mapping found with the specified id");
- if (product.ProductCategories.Where(x => x.Id != model.Id && x.CategoryId == model.CategoryId).Any())
+ if (product.ProductCategories.Any(x => x.Id != model.Id && x.CategoryId == model.CategoryId))
throw new ArgumentException("This category is already mapped with this product");
//a vendor should have access only to his products
@@ -1177,7 +1174,7 @@ namespace Grand.Web.Admin.Services
public virtual async Task DeleteProductCategory(string id, string productId)
{
var product = await _productService.GetProductById(productId, true);
- var productCategory = product.ProductCategories.Where(x => x.Id == id).FirstOrDefault();
+ var productCategory = product.ProductCategories.FirstOrDefault(x => x.Id == id);
if (productCategory == null)
throw new ArgumentException("No product category mapping found with the specified id");
@@ -1220,12 +1217,11 @@ namespace Grand.Web.Admin.Services
}
}
- var existingProductcollections = product.ProductCollections;
- if (product.ProductCollections.Where(x => x.CollectionId == collectionId).Count() == 0)
+ if (!product.ProductCollections.Any(x => x.CollectionId == collectionId))
{
var productCollection = new ProductCollection {
CollectionId = collectionId,
- DisplayOrder = model.DisplayOrder,
+ DisplayOrder = model.DisplayOrder
};
//a vendor cannot edit "IsFeaturedProduct" property
if (_workContext.CurrentVendor == null)
@@ -1238,11 +1234,11 @@ namespace Grand.Web.Admin.Services
public virtual async Task UpdateProductCollection(ProductModel.ProductCollectionModel model)
{
var product = await _productService.GetProductById(model.ProductId, true);
- var productCollection = product.ProductCollections.Where(x => x.Id == model.Id).FirstOrDefault();
+ var productCollection = product.ProductCollections.FirstOrDefault(x => x.Id == model.Id);
if (productCollection == null)
throw new ArgumentException("No product collection mapping found with the specified id");
- if (product.ProductCollections.Where(x => x.Id != model.Id && x.CollectionId == model.CollectionId).Any())
+ if (product.ProductCollections.Any(x => x.Id != model.Id && x.CollectionId == model.CollectionId))
throw new ArgumentException("This collection is already mapped with this product");
//a vendor should have access only to his products
@@ -1265,7 +1261,7 @@ namespace Grand.Web.Admin.Services
public virtual async Task DeleteProductCollection(string id, string productId)
{
var product = await _productService.GetProductById(productId, true);
- var productCollection = product.ProductCollections.Where(x => x.Id == id).FirstOrDefault();
+ var productCollection = product.ProductCollections.FirstOrDefault(x => x.Id == id);
if (productCollection == null)
throw new ArgumentException("No product collection mapping found with the specified id");
//a vendor should have access only to his products
@@ -1293,11 +1289,11 @@ namespace Grand.Web.Admin.Services
var existingRelatedProducts = productId1.RelatedProducts;
if (model.ProductId != id)
- if (existingRelatedProducts.Where(x => x.ProductId2 == id).Count() == 0)
+ if (!existingRelatedProducts.Any(x => x.ProductId2 == id))
{
var related = new RelatedProduct {
ProductId2 = id,
- DisplayOrder = 1,
+ DisplayOrder = 1
};
productId1.RelatedProducts.Add(related);
await _productService.InsertRelatedProduct(related, model.ProductId);
@@ -1308,7 +1304,7 @@ namespace Grand.Web.Admin.Services
public virtual async Task UpdateRelatedProductModel(ProductModel.RelatedProductModel model)
{
var product1 = await _productService.GetProductById(model.ProductId1, true);
- var relatedProduct = product1.RelatedProducts.Where(x => x.Id == model.Id).FirstOrDefault();
+ var relatedProduct = product1.RelatedProducts.FirstOrDefault(x => x.Id == model.Id);
if (relatedProduct == null)
throw new ArgumentException("No related product found with the specified id");
@@ -1329,7 +1325,7 @@ namespace Grand.Web.Admin.Services
public virtual async Task DeleteRelatedProductModel(ProductModel.RelatedProductModel model)
{
var product = await _productService.GetProductById(model.ProductId1, true);
- var relatedProduct = product.RelatedProducts.Where(x => x.Id == model.Id).FirstOrDefault();
+ var relatedProduct = product.RelatedProducts.FirstOrDefault(x => x.Id == model.Id);
if (relatedProduct == null)
throw new ArgumentException("No related product found with the specified id");
@@ -1347,7 +1343,7 @@ namespace Grand.Web.Admin.Services
{
var productId1 = await _productService.GetProductById(model.ProductId, true);
- foreach (string id in model.SelectedProductIds)
+ foreach (var id in model.SelectedProductIds)
{
var product = await _productService.GetProductById(id);
if (product != null)
@@ -1358,12 +1354,12 @@ namespace Grand.Web.Admin.Services
var existingSimilarProducts = productId1.SimilarProducts;
if (model.ProductId != id)
- if (existingSimilarProducts.Where(x => x.ProductId2 == id).Count() == 0)
+ if (!existingSimilarProducts.Any(x => x.ProductId2 == id))
{
var similar = new SimilarProduct {
ProductId1 = model.ProductId,
ProductId2 = id,
- DisplayOrder = 1,
+ DisplayOrder = 1
};
productId1.SimilarProducts.Add(similar);
await _productService.InsertSimilarProduct(similar);
@@ -1374,7 +1370,7 @@ namespace Grand.Web.Admin.Services
public virtual async Task UpdateSimilarProductModel(ProductModel.SimilarProductModel model)
{
var product1 = await _productService.GetProductById(model.ProductId1, true);
- var similarProduct = product1.SimilarProducts.Where(x => x.Id == model.Id).FirstOrDefault();
+ var similarProduct = product1.SimilarProducts.FirstOrDefault(x => x.Id == model.Id);
if (similarProduct == null)
throw new ArgumentException("No similar product found with the specified id");
@@ -1396,7 +1392,7 @@ namespace Grand.Web.Admin.Services
public virtual async Task DeleteSimilarProductModel(ProductModel.SimilarProductModel model)
{
var product = await _productService.GetProductById(model.ProductId1, true);
- var similarProduct = product.SimilarProducts.Where(x => x.Id == model.Id).FirstOrDefault();
+ var similarProduct = product.SimilarProducts.FirstOrDefault(x => x.Id == model.Id);
if (similarProduct == null)
throw new ArgumentException("No similar product found with the specified id");
@@ -1426,12 +1422,12 @@ namespace Grand.Web.Admin.Services
var existingBundleProducts = productId1.BundleProducts;
if (model.ProductId != id)
- if (existingBundleProducts.Where(x => x.ProductId == id).Count() == 0)
+ if (!existingBundleProducts.Any(x => x.ProductId == id))
{
var bundle = new BundleProduct {
ProductId = id,
DisplayOrder = 1,
- Quantity = 1,
+ Quantity = 1
};
productId1.BundleProducts.Add(bundle);
await _productService.InsertBundleProduct(bundle, model.ProductId);
@@ -1442,7 +1438,7 @@ namespace Grand.Web.Admin.Services
public virtual async Task UpdateBundleProductModel(ProductModel.BundleProductModel model)
{
var product = await _productService.GetProductById(model.ProductBundleId, true);
- var bundleProduct = product.BundleProducts.Where(x => x.Id == model.Id).FirstOrDefault();
+ var bundleProduct = product.BundleProducts.FirstOrDefault(x => x.Id == model.Id);
if (bundleProduct == null)
throw new ArgumentException("No bundle product found with the specified id");
@@ -1465,7 +1461,7 @@ namespace Grand.Web.Admin.Services
public virtual async Task DeleteBundleProductModel(ProductModel.BundleProductModel model)
{
var product = await _productService.GetProductById(model.ProductBundleId, true);
- var bundleProduct = product.BundleProducts.Where(x => x.Id == model.Id).FirstOrDefault();
+ var bundleProduct = product.BundleProducts.FirstOrDefault(x => x.Id == model.Id);
if (bundleProduct == null)
throw new ArgumentException("No bundle product found with the specified id");
@@ -1491,13 +1487,13 @@ namespace Grand.Web.Admin.Services
if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id)
continue;
- if (crossSellProduct.CrossSellProduct.Where(x => x == id).Count() == 0)
+ if (!crossSellProduct.CrossSellProduct.Any(x => x == id))
{
if (model.ProductId != id)
await _productService.InsertCrossSellProduct(
new CrossSellProduct {
ProductId1 = model.ProductId,
- ProductId2 = id,
+ ProductId2 = id
});
}
}
@@ -1505,7 +1501,7 @@ namespace Grand.Web.Admin.Services
}
public virtual async Task DeleteCrossSellProduct(string productId, string crossSellProductId)
{
- var crosssell = new CrossSellProduct() {
+ var crosssell = new CrossSellProduct {
ProductId1 = productId,
ProductId2 = crossSellProductId
};
@@ -1524,7 +1520,7 @@ namespace Grand.Web.Admin.Services
if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id)
continue;
- if (mainproduct.RecommendedProduct.Where(x => x == id).Count() == 0)
+ if (!mainproduct.RecommendedProduct.Any(x => x == id))
{
if (model.ProductId != id)
await _productService.InsertRecommendedProduct(model.ProductId, id);
@@ -1605,17 +1601,17 @@ namespace Grand.Web.Admin.Services
if (await _groupService.IsStaff(_workContext.CurrentCustomer))
{
storeId = _workContext.CurrentCustomer.StaffStoreId;
- var store = (await _storeService.GetAllStores()).Where(x => x.Id == storeId).FirstOrDefault();
+ var store = (await _storeService.GetAllStores()).FirstOrDefault(x => x.Id == storeId);
if (store != null)
- model.AvailableStores.Add(new SelectListItem { Text = store.Shortcut, Value = store.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = store.Shortcut, Value = store.Id });
}
else
{
model.AvailableStores.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" });
- foreach (var s in (await _storeService.GetAllStores()))
+ foreach (var s in await _storeService.GetAllStores())
{
- model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id.ToString() });
+ model.AvailableStores.Add(new SelectListItem { Text = s.Shortcut, Value = s.Id });
}
}
return model;
@@ -1662,7 +1658,7 @@ namespace Grand.Web.Admin.Services
return productModel;
})), products.TotalCount);
}
- public virtual async Task UpdateBulkEdit(IList<BulkEditProductModel> products)
+ public virtual async Task UpdateBulkEdit(IEnumerable<BulkEditProductModel> products)
{
foreach (var pModel in products)
{
@@ -1706,7 +1702,7 @@ namespace Grand.Web.Admin.Services
}
}
- public virtual async Task DeleteBulkEdit(IList<BulkEditProductModel> products)
+ public virtual async Task DeleteBulkEdit(IEnumerable<BulkEditProductModel> products)
{
foreach (var pModel in products)
{
@@ -1764,7 +1760,7 @@ namespace Grand.Web.Admin.Services
StartDateTime = x.StartDateTimeUtc.HasValue ? _dateTimeService.ConvertToUserTime(x.StartDateTimeUtc.Value, DateTimeKind.Utc) : new DateTime?(),
EndDateTime = x.EndDateTimeUtc.HasValue ? _dateTimeService.ConvertToUserTime(x.EndDateTimeUtc.Value, DateTimeKind.Utc) : new DateTime?()
});
- };
+ }
return items;
}
public virtual async Task<(IEnumerable<ProductModel.BidModel> bidModels, int totalCount)> PrepareBidMode(string productId, int pageIndex, int pageSize)
@@ -1813,7 +1809,7 @@ namespace Grand.Web.Admin.Services
};
foreach (var attribute in await _productAttributeService.GetAllProductAttributes())
{
- model.AvailableProductAttribute.Add(new SelectListItem() {
+ model.AvailableProductAttribute.Add(new SelectListItem {
Value = attribute.Id,
Text = attribute.Name
});
@@ -1825,7 +1821,7 @@ namespace Grand.Web.Admin.Services
var model = productAttributeMapping.ToModel();
foreach (var attribute in await _productAttributeService.GetAllProductAttributes())
{
- model.AvailableProductAttribute.Add(new SelectListItem() {
+ model.AvailableProductAttribute.Add(new SelectListItem {
Value = attribute.Id,
Text = attribute.Name,
Selected = attribute.Id == model.ProductAttributeId
@@ -1837,7 +1833,7 @@ namespace Grand.Web.Admin.Services
{
foreach (var attribute in await _productAttributeService.GetAllProductAttributes())
{
- model.AvailableProductAttribute.Add(new SelectListItem() {
+ model.AvailableProductAttribute.Add(new SelectListItem {
Value = attribute.Id,
Text = attribute.Name
});
@@ -1905,9 +1901,8 @@ namespace Grand.Web.Admin.Services
{
var productAttribute = await _productAttributeService.GetProductAttributeById(conditionAttribute.ProductAttributeId);
var _paname = productAttribute != null ? productAttribute.Name : "";
- attributeModel.ConditionString = string.Format("{0}: {1}",
- System.Net.WebUtility.HtmlEncode(_paname),
- System.Net.WebUtility.HtmlEncode(conditionValue.Name));
+ attributeModel.ConditionString =
+ $"{System.Net.WebUtility.HtmlEncode(_paname)}: {System.Net.WebUtility.HtmlEncode(conditionValue.Name)}";
}
else
attributeModel.ConditionString = string.Empty;
@@ -1933,7 +1928,7 @@ namespace Grand.Web.Admin.Services
{
var name = predefinedValue.GetTranslation(x => x.Name, lang.Id, false);
if (!string.IsNullOrEmpty(name))
- pav.Locales.Add(new TranslationEntity() { LanguageId = lang.Id, LocaleKey = "Name", LocaleValue = name });
+ pav.Locales.Add(new TranslationEntity { LanguageId = lang.Id, LocaleKey = "Name", LocaleValue = name });
}
productAttributeMapping.ProductAttributeValues.Add(pav);
@@ -1945,7 +1940,7 @@ namespace Grand.Web.Admin.Services
var product = await _productService.GetProductById(model.ProductId, true);
if (product != null)
{
- var productAttributeMapping = product.ProductAttributeMappings.Where(x => x.Id == model.Id).FirstOrDefault();
+ var productAttributeMapping = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == model.Id);
if (productAttributeMapping != null)
{
productAttributeMapping = model.ToEntity(productAttributeMapping);
@@ -1964,7 +1959,7 @@ namespace Grand.Web.Admin.Services
ValidationMaxLength = productAttributeMapping.ValidationMaxLength,
ValidationFileAllowedExtensions = productAttributeMapping.ValidationFileAllowedExtensions,
ValidationFileMaximumSize = productAttributeMapping.ValidationFileMaximumSize,
- DefaultValue = productAttributeMapping.DefaultValue,
+ DefaultValue = productAttributeMapping.DefaultValue
};
return await Task.FromResult(model);
}
@@ -2074,7 +2069,7 @@ namespace Grand.Web.Admin.Services
var attribute = product.ProductAttributeMappings.FirstOrDefault(x => x.Id == model.SelectedProductAttributeId);
if (attribute != null)
{
- var controlId = string.Format("product_attribute_{0}", attribute.Id);
+ var controlId = $"product_attribute_{attribute.Id}";
switch (attribute.AttributeControlTypeId)
{
case AttributeControlType.DropdownList:
@@ -2097,11 +2092,11 @@ namespace Grand.Web.Admin.Services
break;
case AttributeControlType.Checkboxes:
{
- form.TryGetValue(controlId, out string cblAttributes);
+ form.TryGetValue(controlId, out var cblAttributes);
if (!string.IsNullOrEmpty(cblAttributes))
{
var anyValueSelected = false;
- foreach (var item in cblAttributes.ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
+ foreach (var item in cblAttributes.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
{
if (!string.IsNullOrEmpty(item))
{
@@ -2180,7 +2175,7 @@ namespace Grand.Web.Admin.Services
var pictureThumbnailUrl = await _pictureService.GetPictureUrl(string.IsNullOrEmpty(x.PictureId) ? x.ImageSquaresPictureId : x.PictureId, 100, false);
if (string.IsNullOrEmpty(pictureThumbnailUrl))
- pictureThumbnailUrl = await _pictureService.GetPictureUrl("", 1, true);
+ pictureThumbnailUrl = await _pictureService.GetPictureUrl("", 1);
items.Add(new ProductModel.ProductAttributeValueModel {
Id = x.Id,
@@ -2189,7 +2184,7 @@ namespace Grand.Web.Admin.Services
AttributeValueTypeName = x.AttributeValueTypeId.GetTranslationEnum(_translationService, _workContext),
AssociatedProductId = x.AssociatedProductId,
AssociatedProductName = associatedProduct != null ? associatedProduct.Name : "",
- Name = productAttributeMapping.AttributeControlTypeId != AttributeControlType.ColorSquares ? x.Name : string.Format("{0} - {1}", x.Name, x.ColorSquaresRgb),
+ Name = productAttributeMapping.AttributeControlTypeId != AttributeControlType.ColorSquares ? x.Name : $"{x.Name} - {x.ColorSquaresRgb}",
ColorSquaresRgb = x.ColorSquaresRgb,
ImageSquaresPictureId = x.ImageSquaresPictureId,
PriceAdjustment = x.PriceAdjustment,
@@ -2203,7 +2198,7 @@ namespace Grand.Web.Admin.Services
DisplayOrder = x.DisplayOrder,
PictureId = x.PictureId,
PictureThumbnailUrl = pictureThumbnailUrl,
- ProductId = product.Id,
+ ProductId = product.Id
});
}
return items;
@@ -2253,8 +2248,8 @@ namespace Grand.Web.Admin.Services
IsPreSelected = model.IsPreSelected,
DisplayOrder = model.DisplayOrder,
PictureId = model.PictureId,
+ Locales = model.Locales.ToTranslationProperty()
};
- pav.Locales = model.Locales.ToTranslationProperty();
await _productAttributeService.InsertProductAttributeValue(pav, model.ProductId, model.ProductAttributeMappingId);
}
public virtual async Task UpdateProductAttributeValueModel(ProductAttributeValue pav, ProductModel.ProductAttributeValueModel model)
@@ -2282,7 +2277,7 @@ namespace Grand.Web.Admin.Services
}
public virtual async Task<IList<ProductModel.ProductAttributeCombinationModel>> PrepareProductAttributeCombinationModel(Product product)
{
- var shoppingCartService = _serviceProvider.GetRequiredService<IShoppingCartService>();
+ _serviceProvider.GetRequiredService<IShoppingCartService>();
var items = new List<ProductModel.ProductAttributeCombinationModel>();
foreach (var x in product.ProductAttributeCombinations)
@@ -2408,7 +2403,7 @@ namespace Grand.Web.Admin.Services
}
foreach (var attribute in attributes)
{
- var controlId = string.Format("product_attribute_{0}", attribute.Id);
+ var controlId = $"product_attribute_{attribute.Id}";
switch (attribute.AttributeControlTypeId)
{
case AttributeControlType.DropdownList:
@@ -2426,10 +2421,10 @@ namespace Grand.Web.Admin.Services
break;
case AttributeControlType.Checkboxes:
{
- form.TryGetValue(controlId, out string cblAttributes);
+ form.TryGetValue(controlId, out var cblAttributes);
if (!string.IsNullOrEmpty(cblAttributes))
{
- foreach (var item in cblAttributes.ToString().Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
+ foreach (var item in cblAttributes.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
{
if (!string.IsNullOrEmpty(item))
customAttributes = Domain.Catalog.ProductExtensions.AddProductAttribute(customAttributes,
@@ -2452,8 +2447,6 @@ namespace Grand.Web.Admin.Services
}
}
break;
- default:
- break;
}
}
@@ -2583,7 +2576,7 @@ namespace Grand.Web.Admin.Services
Mpn = null,
Gtin = null,
OverriddenPrice = null,
- NotifyAdminForQuantityBelow = 1,
+ NotifyAdminForQuantityBelow = 1
};
await _productAttributeService.InsertProductAttributeCombination(combination, product.Id);
}
@@ -2739,7 +2732,7 @@ namespace Grand.Web.Admin.Services
await _productService.InsertProductPicture(new ProductPicture {
PictureId = picture.Id,
- DisplayOrder = displayOrder,
+ DisplayOrder = displayOrder
}, product.Id);
await _pictureService.SetSeoFilename(picture, _pictureService.GetPictureSeName(product.Name));
@@ -2748,7 +2741,7 @@ namespace Grand.Web.Admin.Services
{
var product = await _productService.GetProductById(model.ProductId, true);
- var productPicture = product.ProductPictures.Where(x => x.Id == model.Id).FirstOrDefault();
+ var productPicture = product.ProductPictures.FirstOrDefault(x => x.Id == model.Id);
if (productPicture == null)
throw new ArgumentException("No product picture found with the specified id");
@@ -2780,7 +2773,7 @@ namespace Grand.Web.Admin.Services
{
var product = await _productService.GetProductById(model.ProductId, true);
- var productPicture = product.ProductPictures.Where(x => x.Id == model.Id).FirstOrDefault();
+ var productPicture = product.ProductPictures.FirstOrDefault(x => x.Id == model.Id);
if (productPicture == null)
throw new ArgumentException("No product picture found with the specified id");
@@ -2824,7 +2817,7 @@ namespace Grand.Web.Admin.Services
if (specificationAttribute != null)
{
psaModel.AttributeName = specificationAttribute.Name;
- psaModel.ValueRaw = System.Net.WebUtility.HtmlEncode(specificationAttribute.SpecificationAttributeOptions.Where(y => y.Id == x.SpecificationAttributeOptionId).FirstOrDefault()?.Name);
+ psaModel.ValueRaw = System.Net.WebUtility.HtmlEncode(specificationAttribute.SpecificationAttributeOptions.FirstOrDefault(y => y.Id == x.SpecificationAttributeOptionId)?.Name);
}
psaModel.SpecificationAttributeOptionId = x.SpecificationAttributeOptionId;
break;
@@ -2838,8 +2831,6 @@ namespace Grand.Web.Admin.Services
case SpecificationAttributeType.Hyperlink:
psaModel.ValueRaw = x.CustomValue;
break;
- default:
- break;
}
items.Add(psaModel);
}
diff --git a/src/Web/Grand.Web.Admin/Services/ShipmentViewModelService.cs b/src/Web/Grand.Web.Admin/Services/ShipmentViewModelService.cs
index 24684a9d4..c53c486d6 100644
--- a/src/Web/Grand.Web.Admin/Services/ShipmentViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/ShipmentViewModelService.cs
@@ -20,7 +20,7 @@ using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Services
{
- public partial class ShipmentViewModelService : IShipmentViewModelService
+ public class ShipmentViewModelService : IShipmentViewModelService
{
private readonly IOrderService _orderService;
private readonly IWorkContext _workContext;
@@ -94,10 +94,10 @@ namespace Grand.Web.Admin.Services
Id = shipment.Id,
ShipmentNumber = shipment.ShipmentNumber,
OrderId = shipment.OrderId,
- OrderNumber = order != null ? order.OrderNumber : 0,
+ OrderNumber = order?.OrderNumber ?? 0,
OrderCode = order != null ? order.Code : "",
TrackingNumber = shipment.TrackingNumber,
- TotalWeight = shipment.TotalWeight.HasValue ? string.Format("{0:F2} [{1}]", shipment.TotalWeight, baseWeightIn) : "",
+ TotalWeight = shipment.TotalWeight.HasValue ? $"{shipment.TotalWeight:F2} [{baseWeightIn}]" : "",
ShippedDate = shipment.ShippedDateUtc.HasValue ? _dateTimeService.ConvertToUserTime(shipment.ShippedDateUtc.Value, DateTimeKind.Utc) : new DateTime?(),
ShippedDateUtc = shipment.ShippedDateUtc,
CanShip = !shipment.ShippedDateUtc.HasValue,
@@ -113,7 +113,7 @@ namespace Grand.Web.Admin.Services
foreach (var shipmentItem in shipment.ShipmentItems)
{
- var orderItem = order.OrderItems.Where(x => x.Id == shipmentItem.OrderItemId).FirstOrDefault();
+ var orderItem = order.OrderItems.FirstOrDefault(x => x.Id == shipmentItem.OrderItemId);
if (orderItem == null)
continue;
@@ -137,14 +137,15 @@ namespace Grand.Web.Admin.Services
ProductName = product.Name,
Sku = product.FormatSku(orderItem.Attributes),
AttributeInfo = orderItem.AttributeDescription,
- ShippedFromWarehouse = warehouse != null ? warehouse.Name : null,
+ ShippedFromWarehouse = warehouse?.Name,
ShipSeparately = product.ShipSeparately,
- ItemWeight = orderItem.ItemWeight.HasValue ? string.Format("{0:F2} [{1}]", orderItem.ItemWeight, baseWeightIn) : "",
- ItemDimensions = string.Format("{0:F2} x {1:F2} x {2:F2} [{3}]", product.Length, product.Width, product.Height, baseDimensionIn),
+ ItemWeight = orderItem.ItemWeight.HasValue ? $"{orderItem.ItemWeight:F2} [{baseWeightIn}]" : "",
+ ItemDimensions =
+ $"{product.Length:F2} x {product.Width:F2} x {product.Height:F2} [{baseDimensionIn}]",
QuantityOrdered = qtyOrdered,
QuantityInThisShipment = qtyInThisShipment,
QuantityInAllShipments = qtyInAllShipments,
- QuantityToAdd = maxQtyToAdd,
+ QuantityToAdd = maxQtyToAdd
};
model.Items.Add(shipmentItemModel);
@@ -241,8 +242,8 @@ namespace Grand.Web.Admin.Services
shipmentNoteModels.Add(new ShipmentModel.ShipmentNote {
Id = shipmentNote.Id,
ShipmentId = shipment.Id,
- DownloadId = String.IsNullOrEmpty(shipmentNote.DownloadId) ? "" : shipmentNote.DownloadId,
- DownloadGuid = download != null ? download.DownloadGuid : Guid.Empty,
+ DownloadId = string.IsNullOrEmpty(shipmentNote.DownloadId) ? "" : shipmentNote.DownloadId,
+ DownloadGuid = download?.DownloadGuid ?? Guid.Empty,
DisplayToCustomer = shipmentNote.DisplayToCustomer,
Note = shipmentNote.Note,
CreatedOn = _dateTimeService.ConvertToUserTime(shipmentNote.CreatedOnUtc, DateTimeKind.Utc),
@@ -259,7 +260,7 @@ namespace Grand.Web.Admin.Services
Note = message,
DownloadId = downloadId,
ShipmentId = shipment.Id,
- CreatedOnUtc = DateTime.UtcNow,
+ CreatedOnUtc = DateTime.UtcNow
};
await _shipmentService.InsertShipmentNote(shipmentNote);
@@ -288,16 +289,16 @@ namespace Grand.Web.Admin.Services
public virtual Task LogShipment(string shipmentId, string message)
{
_ = _customerActivityService.InsertActivity("EditShipment", shipmentId,
- _workContext.CurrentCustomer, _httpContextAccessor.HttpContext?.Connection?.RemoteIpAddress?.ToString(), message);
+ _workContext.CurrentCustomer, _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress?.ToString(), message);
return Task.CompletedTask;
}
public virtual async Task<(IEnumerable<Shipment> shipments, int totalCount)> PrepareShipments(ShipmentListModel model, int pageIndex, int pageSize)
{
- DateTime? startDateValue = (model.StartDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
+ DateTime? startDateValue = model.StartDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.StartDate.Value, _dateTimeService.CurrentTimeZone);
- DateTime? endDateValue = (model.EndDate == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
+ DateTime? endDateValue = model.EndDate == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.EndDate.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
//load shipments
var shipments = await _shipmentService.GetAllShipments(
@@ -322,14 +323,14 @@ namespace Grand.Web.Admin.Services
//countries
model.AvailableCountries.Add(new SelectListItem { Text = "*", Value = "" });
foreach (var c in await _countryService.GetAllCountries(showHidden: true))
- model.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id.ToString() });
+ model.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id });
//states
model.AvailableStates.Add(new SelectListItem { Text = "*", Value = "" });
//warehouses
model.AvailableWarehouses.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Common.All"), Value = "" });
foreach (var w in await _warehouseService.GetAllWarehouses())
- model.AvailableWarehouses.Add(new SelectListItem { Text = w.Name, Value = w.Id.ToString() });
+ model.AvailableWarehouses.Add(new SelectListItem { Text = w.Name, Value = w.Id });
return model;
}
@@ -378,12 +379,13 @@ namespace Grand.Web.Admin.Services
Sku = product.FormatSku(orderItem.Attributes),
AttributeInfo = orderItem.AttributeDescription,
ShipSeparately = product.ShipSeparately,
- ItemWeight = orderItem.ItemWeight.HasValue ? string.Format("{0:F2} [{1}]", orderItem.ItemWeight, baseWeightIn) : "",
- ItemDimensions = string.Format("{0:F2} x {1:F2} x {2:F2} [{3}]", product.Length, product.Width, product.Height, baseDimensionIn),
+ ItemWeight = orderItem.ItemWeight.HasValue ? $"{orderItem.ItemWeight:F2} [{baseWeightIn}]" : "",
+ ItemDimensions =
+ $"{product.Length:F2} x {product.Width:F2} x {product.Height:F2} [{baseDimensionIn}]",
QuantityOrdered = qtyOrdered,
QuantityInThisShipment = qtyInThisShipment,
QuantityInAllShipments = qtyInAllShipments,
- QuantityToAdd = maxQtyToAdd,
+ QuantityToAdd = maxQtyToAdd
};
if (product.ManageInventoryMethodId == ManageInventoryMethod.ManageStock)
@@ -497,7 +499,7 @@ namespace Grand.Web.Admin.Services
WarehouseName = warehouse.Name,
WarehouseCode = warehouse.Code,
StockQuantity = await GetStockQty(product, warehouse.Id),
- ReservedQuantity = await GetReservedQty(product, warehouse.Id),
+ ReservedQuantity = await GetReservedQty(product, warehouse.Id)
});
}
}
@@ -536,7 +538,7 @@ namespace Grand.Web.Admin.Services
return (true, string.Empty);
}
- public virtual async Task<(Shipment shipment, double? totalWeight)> PrepareShipment(Order order, IList<OrderItem> orderItems, IFormCollection form)
+ public virtual async Task<(Shipment shipment, double? totalWeight)> PrepareShipment(Order order, IEnumerable<OrderItem> orderItems, IFormCollection form)
{
Shipment shipment = null;
double? totalWeight = null;
@@ -550,23 +552,23 @@ namespace Grand.Web.Admin.Services
if (orderItem.OpenQty <= 0)
continue;
- int qtyToAdd = 0; //parse quantity
- foreach (string formKey in form.Keys)
- if (formKey.Equals(string.Format("qtyToAdd{0}", orderItem.Id), StringComparison.OrdinalIgnoreCase))
+ var qtyToAdd = 0; //parse quantity
+ foreach (var formKey in form.Keys)
+ if (formKey.Equals($"qtyToAdd{orderItem.Id}", StringComparison.OrdinalIgnoreCase))
{
_ = int.TryParse(form[formKey], out qtyToAdd);
break;
}
var product = await _productService.GetProductById(orderItem.ProductId);
- string warehouseId = "";
+ var warehouseId = "";
if (product != null && (((product.ManageInventoryMethodId == ManageInventoryMethod.ManageStock || product.ManageInventoryMethodId == ManageInventoryMethod.ManageStockByAttributes) &&
- product.UseMultipleWarehouses) || (product.ManageInventoryMethodId == ManageInventoryMethod.ManageStockByBundleProducts)))
+ product.UseMultipleWarehouses) || product.ManageInventoryMethodId == ManageInventoryMethod.ManageStockByBundleProducts))
{
//multiple warehouses supported
//warehouse is chosen by a store owner
- foreach (string formKey in form.Keys)
- if (formKey.Equals(string.Format("warehouse_{0}", orderItem.Id), StringComparison.OrdinalIgnoreCase))
+ foreach (var formKey in form.Keys)
+ if (formKey.Equals($"warehouse_{orderItem.Id}", StringComparison.OrdinalIgnoreCase))
{
warehouseId = form[formKey];
break;
@@ -578,8 +580,8 @@ namespace Grand.Web.Admin.Services
warehouseId = orderItem.WarehouseId;
}
- foreach (string formKey in form.Keys)
- if (formKey.Equals(string.Format("qtyToAdd{0}", orderItem.Id), StringComparison.OrdinalIgnoreCase))
+ foreach (var formKey in form.Keys)
+ if (formKey.Equals($"qtyToAdd{orderItem.Id}", StringComparison.OrdinalIgnoreCase))
{
_ = int.TryParse(form[formKey], out qtyToAdd);
break;
@@ -592,7 +594,7 @@ namespace Grand.Web.Admin.Services
qtyToAdd = orderItem.OpenQty;
//ok. we have at least one item. create a shipment (if it does not exist)
- var orderItemTotalWeight = orderItem.ItemWeight.HasValue ? orderItem.ItemWeight * qtyToAdd : null;
+ var orderItemTotalWeight = orderItem.ItemWeight * qtyToAdd;
if (orderItemTotalWeight.HasValue)
{
if (!totalWeight.HasValue)
@@ -612,7 +614,7 @@ namespace Grand.Web.Admin.Services
DeliveryDateUtc = null,
AdminComment = adminComment,
CreatedOnUtc = DateTime.UtcNow,
- StoreId = order.StoreId,
+ StoreId = order.StoreId
};
if (_workContext.CurrentVendor != null)
{
diff --git a/src/Web/Grand.Web.Admin/Services/StoreViewModelService.cs b/src/Web/Grand.Web.Admin/Services/StoreViewModelService.cs
index 6a988400d..2e57233d3 100644
--- a/src/Web/Grand.Web.Admin/Services/StoreViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/StoreViewModelService.cs
@@ -4,14 +4,14 @@ using Grand.Business.Core.Interfaces.Common.Directory;
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Interfaces.Common.Stores;
using Grand.Domain.Stores;
-using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
using Grand.Web.Admin.Models.Stores;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Services
{
- public partial class StoreViewModelService : IStoreViewModelService
+ public class StoreViewModelService : IStoreViewModelService
{
private readonly ILanguageService _languageService;
private readonly IWarehouseService _warehouseService;
@@ -126,7 +126,7 @@ namespace Grand.Web.Admin.Services
var storeUri = new Uri(store.Url);
- store.Domains.Add(new DomainHost() {
+ store.Domains.Add(new DomainHost {
HostName = storeUri.Host,
Url = store.SslEnabled ? store.SecureUrl : store.Url,
Primary = true
@@ -149,7 +149,7 @@ namespace Grand.Web.Admin.Services
if (domain == null)
{
var storeUri = new Uri(store.Url);
- store.Domains.Add(new DomainHost() {
+ store.Domains.Add(new DomainHost {
HostName = storeUri.Host,
Url = store.SslEnabled ? store.SecureUrl : store.Url,
Primary = true
@@ -203,7 +203,7 @@ namespace Grand.Web.Admin.Services
var storeUri = new Uri(model.Url);
- store.Domains.Add(new DomainHost() {
+ store.Domains.Add(new DomainHost {
HostName = storeUri.Host,
Url = model.Url
});
diff --git a/src/Web/Grand.Web.Admin/Services/VendorViewModelService.cs b/src/Web/Grand.Web.Admin/Services/VendorViewModelService.cs
index ac47028ce..4d070396e 100644
--- a/src/Web/Grand.Web.Admin/Services/VendorViewModelService.cs
+++ b/src/Web/Grand.Web.Admin/Services/VendorViewModelService.cs
@@ -14,15 +14,15 @@ using Grand.Domain.Seo;
using Grand.Domain.Vendors;
using Grand.SharedKernel.Extensions;
using Grand.Web.Admin.Extensions;
+using Grand.Web.Admin.Extensions.Mapping;
using Grand.Web.Admin.Interfaces;
-using Grand.Web.Admin.Models.Customers;
using Grand.Web.Admin.Models.Vendors;
using MediatR;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace Grand.Web.Admin.Services
{
- public partial class VendorViewModelService : IVendorViewModelService
+ public class VendorViewModelService : IVendorViewModelService
{
private readonly IDiscountService _discountService;
private readonly IVendorService _vendorService;
@@ -136,13 +136,13 @@ namespace Grand.Web.Admin.Services
//address
model.Address.AvailableCountries.Add(new SelectListItem { Text = _translationService.GetResource("Admin.Address.SelectCountry"), Value = "" });
foreach (var c in await _countryService.GetAllCountries(showHidden: true))
- model.Address.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id.ToString(), Selected = (vendor != null && c.Id == vendor.Address.CountryId) });
+ model.Address.AvailableCountries.Add(new SelectListItem { Text = c.Name, Value = c.Id, Selected = vendor != null && c.Id == vendor.Address.CountryId });
- var states = !String.IsNullOrEmpty(model.Address.CountryId) ? (await _countryService.GetCountryById(model.Address.CountryId))?.StateProvinces : new List<StateProvince>();
+ var states = !string.IsNullOrEmpty(model.Address.CountryId) ? (await _countryService.GetCountryById(model.Address.CountryId))?.StateProvinces : new List<StateProvince>();
if (states.Count > 0)
{
foreach (var s in states)
- model.Address.AvailableStates.Add(new SelectListItem { Text = s.Name, Value = s.Id.ToString(), Selected = (vendor != null && s.Id == vendor.Address.StateProvinceId) });
+ model.Address.AvailableStates.Add(new SelectListItem { Text = s.Name, Value = s.Id, Selected = vendor != null && s.Id == vendor.Address.StateProvinceId });
}
}
@@ -159,7 +159,7 @@ namespace Grand.Web.Admin.Services
model.AvailableStores.Add(new SelectListItem
{
Text = s.Shortcut,
- Value = s.Id.ToString()
+ Value = s.Id
});
}
}
@@ -188,8 +188,7 @@ namespace Grand.Web.Admin.Services
{
return (await _customerService
.GetAllCustomers(vendorId: vendorId))
- .Select(c => new VendorModel.AssociatedCustomerInfo()
- {
+ .Select(c => new VendorModel.AssociatedCustomerInfo {
Id = c.Id,
Email = c.Email
})
@@ -225,7 +224,7 @@ namespace Grand.Web.Admin.Services
}
public virtual async Task<Vendor> UpdateVendorModel(Vendor vendor, VendorModel model)
{
- string prevPictureId = vendor.PictureId;
+ var prevPictureId = vendor.PictureId;
vendor = model.ToEntity(vendor);
vendor.Locales = await model.Locales.ToTranslationProperty(vendor, x => x.Name, _seoSettings, _slugService, _languageService);
model.SeName = await vendor.ValidateSeName(model.SeName, vendor.Name, true, _seoSettings, _slugService, _languageService);
@@ -256,7 +255,7 @@ namespace Grand.Web.Admin.Services
await _slugService.SaveSlug(vendor, model.SeName, "");
//delete an old picture (if deleted or updated)
- if (!String.IsNullOrEmpty(prevPictureId) && prevPictureId != vendor.PictureId)
+ if (!string.IsNullOrEmpty(prevPictureId) && prevPictureId != vendor.PictureId)
{
var prevPicture = await _pictureService.GetPictureById(prevPictureId);
if (prevPicture != null)
@@ -302,7 +301,7 @@ namespace Grand.Web.Admin.Services
var vendorNote = new VendorNote
{
Note = message,
- CreatedOnUtc = DateTime.UtcNow,
+ CreatedOnUtc = DateTime.UtcNow
};
vendor.VendorNotes.Add(vendorNote);
await _vendorService.UpdateVendor(vendor);
@@ -323,11 +322,11 @@ namespace Grand.Web.Admin.Services
public virtual async Task<(IEnumerable<VendorReviewModel> vendorReviewModels, int totalCount)> PrepareVendorReviewModel(VendorReviewListModel model, int pageIndex, int pageSize)
{
- DateTime? createdOnFromValue = (model.CreatedOnFrom == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.CreatedOnFrom.Value, _dateTimeService.CurrentTimeZone);
+ DateTime? createdOnFromValue = model.CreatedOnFrom == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.CreatedOnFrom.Value, _dateTimeService.CurrentTimeZone);
- DateTime? createdToFromValue = (model.CreatedOnTo == null) ? null
- : (DateTime?)_dateTimeService.ConvertToUtcTime(model.CreatedOnTo.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
+ DateTime? createdToFromValue = model.CreatedOnTo == null ? null
+ : _dateTimeService.ConvertToUtcTime(model.CreatedOnTo.Value, _dateTimeService.CurrentTimeZone).AddDays(1);
IPagedList<VendorReview> vendorReviews = await _vendorService.GetAllVendorReviews("", null,
createdOnFromValue, createdToFromValue, model.SearchText, model.SearchVendorId, pageIndex - 1, pageSize);
@@ -360,12 +359,12 @@ namespace Grand.Web.Admin.Services
//update vendor totals
await _vendorService.UpdateVendorReviewTotals(vendor);
}
- public virtual async Task ApproveVendorReviews(IList<string> selectedIds)
+ public virtual async Task ApproveVendorReviews(IEnumerable<string> selectedIds)
{
foreach (var id in selectedIds)
{
- string idReview = id.Split(':').First().ToString();
- string idVendor = id.Split(':').Last().ToString();
+ var idReview = id.Split(':').First();
+ var idVendor = id.Split(':').Last();
var vendor = await _vendorService.GetVendorById(idVendor);
var vendorReview = await _vendorService.GetVendorReviewById(idReview);
if (vendorReview != null)
@@ -381,12 +380,12 @@ namespace Grand.Web.Admin.Services
}
}
}
- public virtual async Task DisapproveVendorReviews(IList<string> selectedIds)
+ public virtual async Task DisapproveVendorReviews(IEnumerable<string> selectedIds)
{
foreach (var id in selectedIds)
{
- string idReview = id.Split(':').First().ToString();
- string idVendor = id.Split(':').Last().ToString();
+ var idReview = id.Split(':').First();
+ var idVendor = id.Split(':').Last();
var vendor = await _vendorService.GetVendorById(idVendor);
var vendorReview = await _vendorService.GetVendorReviewById(idReview);
diff --git a/src/Web/Grand.Web.Admin/Startup/StartupApplication.cs b/src/Web/Grand.Web.Admin/Startup/StartupApplication.cs
index d48cfbb1e..18cfdb467 100644
--- a/src/Web/Grand.Web.Admin/Startup/StartupApplication.cs
+++ b/src/Web/Grand.Web.Admin/Startup/StartupApplication.cs
@@ -57,7 +57,6 @@ namespace Grand.Web.Admin.Startup
services.AddScoped<IProductViewModelService, ProductViewModelService>();
services.AddScoped<IPictureViewModelService, PictureViewModelService>();
services.AddScoped<IElFinderViewModelService, ElFinderViewModelService>();
- services.AddScoped<IGoogleAnalyticsViewModelService, GoogleAnalyticsViewModelService>();
}
public void Configure(IApplicationBuilder application, IWebHostEnvironment webHostEnvironment)
{
diff --git a/src/Web/Grand.Web.Admin/Validators/Affiliate/AffiliateValidator.cs b/src/Web/Grand.Web.Admin/Validators/Affiliate/AffiliateValidator.cs
index aca80ce27..136f8e459 100644
--- a/src/Web/Grand.Web.Admin/Validators/Affiliate/AffiliateValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Affiliate/AffiliateValidator.cs
@@ -1,9 +1,9 @@
using FluentValidation;
-using Grand.Infrastructure.Validators;
using Grand.Business.Core.Interfaces.Common.Localization;
+using Grand.Infrastructure.Validators;
using Grand.Web.Admin.Models.Affiliates;
-namespace Grand.Web.Admin.Validators.Blogs
+namespace Grand.Web.Admin.Validators.Affiliate
{
public class AffiliateValidator : BaseGrandValidator<AffiliateModel>
{
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/AddAssociatedProductModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/AddAssociatedProductModelValidator.cs
index 47e256a17..9f65f6a24 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/AddAssociatedProductModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/AddAssociatedProductModelValidator.cs
@@ -17,7 +17,7 @@ namespace Grand.Web.Admin.Validators.Catalog
{
if (!string.IsNullOrEmpty(workContext.CurrentCustomer.StaffStoreId))
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
@@ -29,11 +29,11 @@ namespace Grand.Web.Admin.Validators.Catalog
}
else if (workContext.CurrentVendor != null)
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
- if (product != null && product.VendorId != workContext.CurrentVendor.Id)
+ if (product.VendorId != workContext.CurrentVendor.Id)
return false;
return true;
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/AddBundleProductModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/AddBundleProductModelValidator.cs
index c80f56de7..b6d883e1e 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/AddBundleProductModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/AddBundleProductModelValidator.cs
@@ -17,7 +17,7 @@ namespace Grand.Web.Admin.Validators.Catalog
{
if (!string.IsNullOrEmpty(workContext.CurrentCustomer.StaffStoreId))
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
@@ -29,11 +29,11 @@ namespace Grand.Web.Admin.Validators.Catalog
}
else if (workContext.CurrentVendor != null)
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
- if (product != null && product.VendorId != workContext.CurrentVendor.Id)
+ if (product.VendorId != workContext.CurrentVendor.Id)
return false;
return true;
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/AddCategoryProductModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/AddCategoryProductModelValidator.cs
index 6e0d8a2fd..567fcb876 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/AddCategoryProductModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/AddCategoryProductModelValidator.cs
@@ -17,7 +17,7 @@ namespace Grand.Web.Admin.Validators.Catalog
{
if (!string.IsNullOrEmpty(workContext.CurrentCustomer.StaffStoreId))
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var category = await categoryService.GetCategoryById(x.CategoryId);
if (category != null)
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/AddCollectionProductModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/AddCollectionProductModelValidator.cs
index c6279245e..26a29a820 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/AddCollectionProductModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/AddCollectionProductModelValidator.cs
@@ -17,7 +17,7 @@ namespace Grand.Web.Admin.Validators.Catalog
{
if (!string.IsNullOrEmpty(workContext.CurrentCustomer.StaffStoreId))
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var collection = await collectionService.GetCollectionById(x.CollectionId);
if (collection != null)
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/AddCrossSellProductModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/AddCrossSellProductModelValidator.cs
index ca2bc89a2..9674ff1cd 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/AddCrossSellProductModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/AddCrossSellProductModelValidator.cs
@@ -17,7 +17,7 @@ namespace Grand.Web.Admin.Validators.Catalog
{
if (!string.IsNullOrEmpty(workContext.CurrentCustomer.StaffStoreId))
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
@@ -29,11 +29,11 @@ namespace Grand.Web.Admin.Validators.Catalog
}
else if (workContext.CurrentVendor != null)
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
- if (product != null && product.VendorId != workContext.CurrentVendor.Id)
+ if (product.VendorId != workContext.CurrentVendor.Id)
return false;
return true;
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/AddProductSpecificationAttributeModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/AddProductSpecificationAttributeModelValidator.cs
index e04b16cb7..421b78ace 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/AddProductSpecificationAttributeModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/AddProductSpecificationAttributeModelValidator.cs
@@ -18,7 +18,7 @@ namespace Grand.Web.Admin.Validators.Catalog
{
if (!string.IsNullOrEmpty(workContext.CurrentCustomer.StaffStoreId))
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
@@ -30,18 +30,18 @@ namespace Grand.Web.Admin.Validators.Catalog
}
else if (workContext.CurrentVendor != null)
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
- if (product != null && product.VendorId != workContext.CurrentVendor.Id)
+ if (product.VendorId != workContext.CurrentVendor.Id)
return false;
return true;
}).WithMessage(translationService.GetResource("Admin.Catalog.Products.Permisions"));
}
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
if (x.AttributeTypeId == Domain.Catalog.SpecificationAttributeType.Option)
{
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/AddRelatedProductModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/AddRelatedProductModelValidator.cs
index 2491a7ab5..2ac6e96d3 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/AddRelatedProductModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/AddRelatedProductModelValidator.cs
@@ -17,7 +17,7 @@ namespace Grand.Web.Admin.Validators.Catalog
{
if (!string.IsNullOrEmpty(workContext.CurrentCustomer.StaffStoreId))
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
@@ -29,11 +29,11 @@ namespace Grand.Web.Admin.Validators.Catalog
}
else if (workContext.CurrentVendor != null)
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
- if (product != null && product.VendorId != workContext.CurrentVendor.Id)
+ if (product.VendorId != workContext.CurrentVendor.Id)
return false;
return true;
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/AddSimilarProductModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/AddSimilarProductModelValidator.cs
index 9bc4a2b11..15cb73d60 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/AddSimilarProductModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/AddSimilarProductModelValidator.cs
@@ -17,7 +17,7 @@ namespace Grand.Web.Admin.Validators.Catalog
{
if (!string.IsNullOrEmpty(workContext.CurrentCustomer.StaffStoreId))
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
@@ -29,11 +29,11 @@ namespace Grand.Web.Admin.Validators.Catalog
}
else if (workContext.CurrentVendor != null)
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
- if (product != null && product.VendorId != workContext.CurrentVendor.Id)
+ if (product.VendorId != workContext.CurrentVendor.Id)
return false;
return true;
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/AssociatedProductModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/AssociatedProductModelValidator.cs
index 6bf0b1b91..51f3efed6 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/AssociatedProductModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/AssociatedProductModelValidator.cs
@@ -17,7 +17,7 @@ namespace Grand.Web.Admin.Validators.Catalog
{
if (!string.IsNullOrEmpty(workContext.CurrentCustomer.StaffStoreId))
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
@@ -29,11 +29,11 @@ namespace Grand.Web.Admin.Validators.Catalog
}
else if (workContext.CurrentVendor != null)
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
- if (product != null && product.VendorId != workContext.CurrentVendor.Id)
+ if (product.VendorId != workContext.CurrentVendor.Id)
return false;
return true;
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/BundleProductModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/BundleProductModelValidator.cs
index a93b274b7..3133ff00b 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/BundleProductModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/BundleProductModelValidator.cs
@@ -17,7 +17,7 @@ namespace Grand.Web.Admin.Validators.Catalog
{
if (!string.IsNullOrEmpty(workContext.CurrentCustomer.StaffStoreId))
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductBundleId);
if (product != null)
@@ -29,11 +29,11 @@ namespace Grand.Web.Admin.Validators.Catalog
}
else if (workContext.CurrentVendor != null)
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
- if (product != null && product.VendorId != workContext.CurrentVendor.Id)
+ if (product.VendorId != workContext.CurrentVendor.Id)
return false;
return true;
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/CategoryProductModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/CategoryProductModelValidator.cs
index aaced70d2..e9ff88af4 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/CategoryProductModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/CategoryProductModelValidator.cs
@@ -17,7 +17,7 @@ namespace Grand.Web.Admin.Validators.Catalog
{
if (!string.IsNullOrEmpty(workContext.CurrentCustomer.StaffStoreId))
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var category = await categoryService.GetCategoryById(x.CategoryId);
if (category != null)
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/CollectionProductModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/CollectionProductModelValidator.cs
index 4a899b05b..7fdd06597 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/CollectionProductModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/CollectionProductModelValidator.cs
@@ -17,7 +17,7 @@ namespace Grand.Web.Admin.Validators.Catalog
{
if (!string.IsNullOrEmpty(workContext.CurrentCustomer.StaffStoreId))
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var collection = await collectionService.GetCollectionById(x.CollectionId);
if (collection != null)
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/CrossSellProductModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/CrossSellProductModelValidator.cs
index 160b3813a..5fc59ba35 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/CrossSellProductModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/CrossSellProductModelValidator.cs
@@ -17,7 +17,7 @@ namespace Grand.Web.Admin.Validators.Catalog
{
if (!string.IsNullOrEmpty(workContext.CurrentCustomer.StaffStoreId))
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
@@ -29,11 +29,11 @@ namespace Grand.Web.Admin.Validators.Catalog
}
else if (workContext.CurrentVendor != null)
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
- if (product != null && product.VendorId != workContext.CurrentVendor.Id)
+ if (product.VendorId != workContext.CurrentVendor.Id)
return false;
return true;
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/ProductAttributeMappingModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/ProductAttributeMappingModelValidator.cs
index f603e5be1..507a613cf 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/ProductAttributeMappingModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/ProductAttributeMappingModelValidator.cs
@@ -17,7 +17,7 @@ namespace Grand.Web.Admin.Validators.Catalog
{
if (!string.IsNullOrEmpty(workContext.CurrentCustomer.StaffStoreId))
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
@@ -29,11 +29,11 @@ namespace Grand.Web.Admin.Validators.Catalog
}
else if (workContext.CurrentVendor != null)
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
- if (product != null && product.VendorId != workContext.CurrentVendor.Id)
+ if (product.VendorId != workContext.CurrentVendor.Id)
return false;
return true;
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/ProductAttributeValueModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/ProductAttributeValueModelValidator.cs
index 52671c18a..bbd2c868b 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/ProductAttributeValueModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/ProductAttributeValueModelValidator.cs
@@ -27,7 +27,7 @@ namespace Grand.Web.Admin.Validators.Catalog
if (!string.IsNullOrEmpty(workContext.CurrentCustomer.StaffStoreId))
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
@@ -39,11 +39,11 @@ namespace Grand.Web.Admin.Validators.Catalog
}
else if (workContext.CurrentVendor != null)
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
- if (product != null && product.VendorId != workContext.CurrentVendor.Id)
+ if (product.VendorId != workContext.CurrentVendor.Id)
return false;
return true;
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/ProductCategoryModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/ProductCategoryModelValidator.cs
index a328ffc0d..dad4adb6d 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/ProductCategoryModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/ProductCategoryModelValidator.cs
@@ -17,7 +17,7 @@ namespace Grand.Web.Admin.Validators.Catalog
{
if (!string.IsNullOrEmpty(workContext.CurrentCustomer.StaffStoreId))
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
@@ -29,11 +29,11 @@ namespace Grand.Web.Admin.Validators.Catalog
}
else if (workContext.CurrentVendor != null)
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
- if (product != null && product.VendorId != workContext.CurrentVendor.Id)
+ if (product.VendorId != workContext.CurrentVendor.Id)
return false;
return true;
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/ProductCollectionModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/ProductCollectionModelValidator.cs
index 915b5dba4..53af30f17 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/ProductCollectionModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/ProductCollectionModelValidator.cs
@@ -17,7 +17,7 @@ namespace Grand.Web.Admin.Validators.Catalog
{
if (!string.IsNullOrEmpty(workContext.CurrentCustomer.StaffStoreId))
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
@@ -29,11 +29,11 @@ namespace Grand.Web.Admin.Validators.Catalog
}
else if (workContext.CurrentVendor != null)
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
- if (product != null && product.VendorId != workContext.CurrentVendor.Id)
+ if (product.VendorId != workContext.CurrentVendor.Id)
return false;
return true;
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/ProductPictureModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/ProductPictureModelValidator.cs
index cb8a98248..0f8b3b72a 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/ProductPictureModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/ProductPictureModelValidator.cs
@@ -17,7 +17,7 @@ namespace Grand.Web.Admin.Validators.Catalog
{
if (!string.IsNullOrEmpty(workContext.CurrentCustomer.StaffStoreId))
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
@@ -29,11 +29,11 @@ namespace Grand.Web.Admin.Validators.Catalog
}
else if (workContext.CurrentVendor != null)
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
- if (product != null && product.VendorId != workContext.CurrentVendor.Id)
+ if (product.VendorId != workContext.CurrentVendor.Id)
return false;
return true;
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/ProductSpecificationAttributeModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/ProductSpecificationAttributeModelValidator.cs
index 031645d6d..a741ee67d 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/ProductSpecificationAttributeModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/ProductSpecificationAttributeModelValidator.cs
@@ -17,7 +17,7 @@ namespace Grand.Web.Admin.Validators.Catalog
{
if (!string.IsNullOrEmpty(workContext.CurrentCustomer.StaffStoreId))
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
@@ -29,11 +29,11 @@ namespace Grand.Web.Admin.Validators.Catalog
}
else if (workContext.CurrentVendor != null)
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
- if (product != null && product.VendorId != workContext.CurrentVendor.Id)
+ if (product.VendorId != workContext.CurrentVendor.Id)
return false;
return true;
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/RelatedProductModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/RelatedProductModelValidator.cs
index b0a976ad8..337a65aa6 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/RelatedProductModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/RelatedProductModelValidator.cs
@@ -17,7 +17,7 @@ namespace Grand.Web.Admin.Validators.Catalog
{
if (!string.IsNullOrEmpty(workContext.CurrentCustomer.StaffStoreId))
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId1);
if (product != null)
@@ -29,11 +29,11 @@ namespace Grand.Web.Admin.Validators.Catalog
}
else if (workContext.CurrentVendor != null)
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId1);
if (product != null)
- if (product != null && product.VendorId != workContext.CurrentVendor.Id)
+ if (product.VendorId != workContext.CurrentVendor.Id)
return false;
return true;
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/SimilarProductModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/SimilarProductModelValidator.cs
index 738ff2aa4..5e660943c 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/SimilarProductModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/SimilarProductModelValidator.cs
@@ -17,7 +17,7 @@ namespace Grand.Web.Admin.Validators.Catalog
{
if (!string.IsNullOrEmpty(workContext.CurrentCustomer.StaffStoreId))
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId1);
if (product != null)
@@ -29,11 +29,11 @@ namespace Grand.Web.Admin.Validators.Catalog
}
else if (workContext.CurrentVendor != null)
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId1);
if (product != null)
- if (product != null && product.VendorId != workContext.CurrentVendor.Id)
+ if (product.VendorId != workContext.CurrentVendor.Id)
return false;
return true;
diff --git a/src/Web/Grand.Web.Admin/Validators/Catalog/TierPriceModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Catalog/TierPriceModelValidator.cs
index 46b0b2ada..c0b805c51 100644
--- a/src/Web/Grand.Web.Admin/Validators/Catalog/TierPriceModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Catalog/TierPriceModelValidator.cs
@@ -17,7 +17,7 @@ namespace Grand.Web.Admin.Validators.Catalog
{
if (!string.IsNullOrEmpty(workContext.CurrentCustomer.StaffStoreId))
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
@@ -29,11 +29,11 @@ namespace Grand.Web.Admin.Validators.Catalog
}
else if (workContext.CurrentVendor != null)
{
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
var product = await productService.GetProductById(x.ProductId);
if (product != null)
- if (product != null && product.VendorId != workContext.CurrentVendor.Id)
+ if (product.VendorId != workContext.CurrentVendor.Id)
return false;
return true;
diff --git a/src/Web/Grand.Web.Admin/Validators/Common/LoginValidator.cs b/src/Web/Grand.Web.Admin/Validators/Common/LoginValidator.cs
index 8d5904c6a..1a1e720cd 100644
--- a/src/Web/Grand.Web.Admin/Validators/Common/LoginValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Common/LoginValidator.cs
@@ -60,14 +60,14 @@ namespace Grand.Web.Admin.Validators.Common
case { Active: false }:
context.AddFailure(translationService.GetResource("Account.Login.WrongCredentials.NotActive"));
break;
- case { } when !await groupService.IsRegistered(customer):
+ case not null when !await groupService.IsRegistered(customer):
context.AddFailure(
translationService.GetResource("Account.Login.WrongCredentials.NotRegistered"));
break;
- case { CannotLoginUntilDateUtc: { } } when customer.CannotLoginUntilDateUtc.Value > DateTime.UtcNow:
+ case { CannotLoginUntilDateUtc: not null } when customer.CannotLoginUntilDateUtc.Value > DateTime.UtcNow:
context.AddFailure(translationService.GetResource("Account.Login.WrongCredentials.LockedOut"));
break;
- case { }:
+ case not null:
{
var pwd = customer.PasswordFormatId switch {
PasswordFormat.Clear => x.Password,
@@ -95,7 +95,7 @@ namespace Grand.Web.Admin.Validators.Common
{
RuleFor(x => x.Captcha).NotNull()
.WithMessage(translationService.GetResource("Account.Captcha.Required"));
- ;
+
RuleFor(x => x.Captcha)
.SetValidator(new CaptchaValidator(validatorsCaptcha, contextAccessor, googleReCaptchaValidator));
}
diff --git a/src/Web/Grand.Web.Admin/Validators/Course/CourseLessonValidator.cs b/src/Web/Grand.Web.Admin/Validators/Course/CourseLessonValidator.cs
index caf0263be..41bfc928c 100644
--- a/src/Web/Grand.Web.Admin/Validators/Course/CourseLessonValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Course/CourseLessonValidator.cs
@@ -1,9 +1,9 @@
using FluentValidation;
-using Grand.Infrastructure.Validators;
using Grand.Business.Core.Interfaces.Common.Localization;
+using Grand.Infrastructure.Validators;
using Grand.Web.Admin.Models.Courses;
-namespace Grand.Web.Admin.Validators.Courses
+namespace Grand.Web.Admin.Validators.Course
{
public class CourseLessonValidator : BaseGrandValidator<CourseLessonModel>
{
diff --git a/src/Web/Grand.Web.Admin/Validators/Course/CourseLevelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Course/CourseLevelValidator.cs
index 4721015ba..77d309678 100644
--- a/src/Web/Grand.Web.Admin/Validators/Course/CourseLevelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Course/CourseLevelValidator.cs
@@ -1,9 +1,9 @@
using FluentValidation;
-using Grand.Infrastructure.Validators;
using Grand.Business.Core.Interfaces.Common.Localization;
+using Grand.Infrastructure.Validators;
using Grand.Web.Admin.Models.Courses;
-namespace Grand.Web.Admin.Validators.Courses
+namespace Grand.Web.Admin.Validators.Course
{
public class CourseLevelValidator : BaseGrandValidator<CourseLevelModel>
{
diff --git a/src/Web/Grand.Web.Admin/Validators/Course/CourseSubjectValidator.cs b/src/Web/Grand.Web.Admin/Validators/Course/CourseSubjectValidator.cs
index 19efc3b98..509c1f489 100644
--- a/src/Web/Grand.Web.Admin/Validators/Course/CourseSubjectValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Course/CourseSubjectValidator.cs
@@ -1,9 +1,9 @@
using FluentValidation;
-using Grand.Infrastructure.Validators;
using Grand.Business.Core.Interfaces.Common.Localization;
+using Grand.Infrastructure.Validators;
using Grand.Web.Admin.Models.Courses;
-namespace Grand.Web.Admin.Validators.Courses
+namespace Grand.Web.Admin.Validators.Course
{
public class CourseSubjectValidator : BaseGrandValidator<CourseSubjectModel>
{
diff --git a/src/Web/Grand.Web.Admin/Validators/Course/CourseValidator.cs b/src/Web/Grand.Web.Admin/Validators/Course/CourseValidator.cs
index 0a9a241b7..82a07c4ed 100644
--- a/src/Web/Grand.Web.Admin/Validators/Course/CourseValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Course/CourseValidator.cs
@@ -4,7 +4,7 @@ using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Infrastructure.Validators;
using Grand.Web.Admin.Models.Courses;
-namespace Grand.Web.Admin.Validators.Courses
+namespace Grand.Web.Admin.Validators.Course
{
public class CourseValidator : BaseGrandValidator<CourseModel>
{
@@ -16,7 +16,7 @@ namespace Grand.Web.Admin.Validators.Courses
: base(validators)
{
RuleFor(x => x.Name).NotEmpty().WithMessage(translationService.GetResource("Admin.Courses.Course.Fields.Name.Required"));
- RuleFor(x => x.ProductId).MustAsync(async (x, y, context) =>
+ RuleFor(x => x.ProductId).MustAsync(async (x, _, _) =>
{
if (!string.IsNullOrEmpty(x.ProductId))
{
diff --git a/src/Web/Grand.Web.Admin/Validators/Customers/CustomerValidator.cs b/src/Web/Grand.Web.Admin/Validators/Customers/CustomerValidator.cs
index 8e35c6a05..841486eff 100644
--- a/src/Web/Grand.Web.Admin/Validators/Customers/CustomerValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Customers/CustomerValidator.cs
@@ -1,5 +1,4 @@
-using Amazon.S3;
-using FluentValidation;
+using FluentValidation;
using Grand.Domain.Customers;
using Grand.Infrastructure.Validators;
using Grand.Business.Core.Interfaces.Common.Directory;
@@ -32,7 +31,7 @@ namespace Grand.Web.Admin.Validators.Customers
customerSettings.StateProvinceEnabled &&
customerSettings.StateProvinceRequired)
{
- RuleFor(x => x.StateProvinceId).MustAsync(async (x, y, context) =>
+ RuleFor(x => x.StateProvinceId).MustAsync(async (x, y, _) =>
{
var countryId = !string.IsNullOrEmpty(x.CountryId) ? x.CountryId : "";
var country = await countryService.GetCountryById(countryId);
diff --git a/src/Web/Grand.Web.Admin/Validators/Customers/SalesEmployeeValidator.cs b/src/Web/Grand.Web.Admin/Validators/Customers/SalesEmployeeValidator.cs
index 30aa5cab1..2fb8a1fbf 100644
--- a/src/Web/Grand.Web.Admin/Validators/Customers/SalesEmployeeValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Customers/SalesEmployeeValidator.cs
@@ -1,10 +1,10 @@
using FluentValidation;
-using Grand.Infrastructure.Validators;
using Grand.Business.Core.Interfaces.Common.Localization;
+using Grand.Infrastructure.Validators;
using Grand.Web.Admin.Models.Customers;
using Grand.Web.Admin.Validators.Common;
-namespace Grand.Web.Admin.Validators.Directory
+namespace Grand.Web.Admin.Validators.Customers
{
public class SalesEmployeeValidator : BaseGrandValidator<SalesEmployeeModel>
{
diff --git a/src/Web/Grand.Web.Admin/Validators/Customers/UserApiValidator.cs b/src/Web/Grand.Web.Admin/Validators/Customers/UserApiValidator.cs
index b8409638e..0312deacb 100644
--- a/src/Web/Grand.Web.Admin/Validators/Customers/UserApiValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Customers/UserApiValidator.cs
@@ -14,16 +14,16 @@ namespace Grand.Web.Admin.Validators.Customers
: base(validators)
{
RuleFor(x => x.Email).NotEmpty().WithMessage(translationService.GetResource("Admin.System.UserApi.Email.Required"));
- RuleFor(x => x).MustAsync(async (x, y, context) =>
+ RuleFor(x => x).MustAsync(async (x, _, _) =>
{
if (!string.IsNullOrEmpty(x.Email))
{
var customer = await customerService.GetCustomerByEmail(x.Email.ToLowerInvariant());
- if (customer != null && customer.Active && !customer.IsSystemAccount)
+ if (customer is { Active: true, IsSystemAccount: false })
return true;
}
return false;
- }).WithMessage(translationService.GetResource("Admin.System.UserApi.Email.CustomerNotExist")); ;
+ }).WithMessage(translationService.GetResource("Admin.System.UserApi.Email.CustomerNotExist"));
}
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Admin/Validators/Directory/CurrencyValidator.cs b/src/Web/Grand.Web.Admin/Validators/Directory/CurrencyValidator.cs
index f49d8304d..f0cfa1ad4 100644
--- a/src/Web/Grand.Web.Admin/Validators/Directory/CurrencyValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Directory/CurrencyValidator.cs
@@ -28,11 +28,11 @@ namespace Grand.Web.Admin.Validators.Directory
{
try
{
- if (String.IsNullOrEmpty(x))
+ if (string.IsNullOrEmpty(x))
return true;
//create a CultureInfo object
//if "DisplayLocale" is wrong, then exception will be thrown
- var culture = new CultureInfo(x);
+ new CultureInfo(x);
return true;
}
catch
diff --git a/src/Web/Grand.Web.Admin/Validators/Discounts/DiscountValidator.cs b/src/Web/Grand.Web.Admin/Validators/Discounts/DiscountValidator.cs
index 1803297a5..25f47d76b 100644
--- a/src/Web/Grand.Web.Admin/Validators/Discounts/DiscountValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Discounts/DiscountValidator.cs
@@ -13,7 +13,7 @@ namespace Grand.Web.Admin.Validators.Discounts
: base(validators)
{
RuleFor(x => x.Name).NotEmpty().WithMessage(translationService.GetResource("admin.marketing.discounts.Fields.Name.Required"));
- RuleFor(x => x).Must((x, context) =>
+ RuleFor(x => x).Must((x, _) =>
{
if (x.CalculateByPlugin && string.IsNullOrEmpty(x.DiscountPluginName))
{
diff --git a/src/Web/Grand.Web.Admin/Validators/Knowledgebase/KnowledgebaseCategoryModelValidator.cs b/src/Web/Grand.Web.Admin/Validators/Knowledgebase/KnowledgebaseCategoryModelValidator.cs
index 011894998..d8810114f 100644
--- a/src/Web/Grand.Web.Admin/Validators/Knowledgebase/KnowledgebaseCategoryModelValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Knowledgebase/KnowledgebaseCategoryModelValidator.cs
@@ -14,7 +14,7 @@ namespace Grand.Web.Admin.Validators.Knowledgebase
: base(validators)
{
RuleFor(x => x.Name).NotEmpty().WithMessage(translationService.GetResource("Admin.Content.Knowledgebase.KnowledgebaseCategory.Fields.Name.Required"));
- RuleFor(x => x.ParentCategoryId).MustAsync(async (x, y, context) =>
+ RuleFor(x => x.ParentCategoryId).MustAsync(async (x, _, _) =>
{
if (!string.IsNullOrEmpty(x.ParentCategoryId))
{
diff --git a/src/Web/Grand.Web.Admin/Validators/Localization/LanguageValidator.cs b/src/Web/Grand.Web.Admin/Validators/Localization/LanguageValidator.cs
index 99d46b7db..091829dcb 100644
--- a/src/Web/Grand.Web.Admin/Validators/Localization/LanguageValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Localization/LanguageValidator.cs
@@ -20,7 +20,7 @@ namespace Grand.Web.Admin.Validators.Localization
try
{
//create a CultureInfo object
- var culture = new CultureInfo(x);
+ new CultureInfo(x);
return true;
}
catch
diff --git a/src/Web/Grand.Web.Admin/Validators/Stores/DomainHostValidator.cs b/src/Web/Grand.Web.Admin/Validators/Stores/DomainHostValidator.cs
index 39bf66855..87ecb9f7e 100644
--- a/src/Web/Grand.Web.Admin/Validators/Stores/DomainHostValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Stores/DomainHostValidator.cs
@@ -13,11 +13,11 @@ namespace Grand.Web.Admin.Validators.Stores
: base(validators)
{
RuleFor(x => x.Url).NotEmpty().WithMessage(translationService.GetResource("Admin.Configuration.Stores.Domains.Fields.Url.Required"));
- RuleFor(x => x.Url).Must((x, y, context) =>
+ RuleFor(x => x.Url).Must((x, _, _) =>
{
try
{
- var storeUri = new Uri(x.Url);
+ new Uri(x.Url);
return true;
}
catch
diff --git a/src/Web/Grand.Web.Admin/Validators/Stores/StoreValidator.cs b/src/Web/Grand.Web.Admin/Validators/Stores/StoreValidator.cs
index da1caae7a..df78a2b8c 100644
--- a/src/Web/Grand.Web.Admin/Validators/Stores/StoreValidator.cs
+++ b/src/Web/Grand.Web.Admin/Validators/Stores/StoreValidator.cs
@@ -15,11 +15,11 @@ namespace Grand.Web.Admin.Validators.Stores
RuleFor(x => x.Name).NotEmpty().WithMessage(translationService.GetResource("Admin.Configuration.Stores.Fields.Name.Required"));
RuleFor(x => x.Shortcut).NotEmpty().WithMessage(translationService.GetResource("Admin.Configuration.Stores.Fields.Shortcut.Required"));
RuleFor(x => x.Url).NotEmpty().WithMessage(translationService.GetResource("Admin.Configuration.Stores.Fields.Url.Required"));
- RuleFor(x => x.Url).Must((x, y, context) =>
+ RuleFor(x => x.Url).Must((x, _, _) =>
{
try
{
- var storeUri = new Uri(x.Url);
+ new Uri(x.Url);
return true;
}
catch
@@ -27,7 +27,7 @@ namespace Grand.Web.Admin.Validators.Stores
return false;
}
}).WithMessage(translationService.GetResource("Admin.Configuration.Stores.Fields.Url.WrongFormat"));
- RuleFor(x => x.SecureUrl).Must((x, y, context) =>
+ RuleFor(x => x.SecureUrl).Must((x, _, _) =>
{
try
{
diff --git a/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml b/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml
index d72599658..e5d5c2269 100644
--- a/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml
+++ b/src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml
@@ -7164,21 +7164,6 @@
<Resource Name="Admin.Dashboard.ActivityOverview.TodayRegisteredCustomers" Area="Admin">
<Value>Today Registered Customers</Value>
</Resource>
- <Resource Name="Admin.Dashboard.GoogleAnalytics" Area="Admin">
- <Value>Google Analytics</Value>
- </Resource>
- <Resource Name="Admin.Dashboard.GoogleAnalytics.Device" Area="Admin">
- <Value>Google Analytics - Device</Value>
- </Resource>
- <Resource Name="Admin.Dashboard.GoogleAnalytics.Exit" Area="Admin">
- <Value>Google Analytics - Exit Pages</Value>
- </Resource>
- <Resource Name="Admin.Dashboard.GoogleAnalytics.Localization" Area="Admin">
- <Value>Google Analytics - Localization</Value>
- </Resource>
- <Resource Name="Admin.Dashboard.GoogleAnalytics.Source" Area="Admin">
- <Value>Google Analytics - All Traffic</Value>
- </Resource>
<Resource Name="Admin.Dashboard.OnlineCustomerMinutes" Area="Admin">
<Value>in the last {0} minutes</Value>
</Resource>
@@ -10653,59 +10638,6 @@
<Resource Name="Admin.Settings.GeneralCommon.GenerateProductMetaDescription" Area="Admin">
<Value>If not provided, generate product META description automatically</Value>
</Resource>
- <Resource Name="Admin.Settings.GeneralCommon.GoogleAnalytics" Area="Admin">
- <Value>Google Analytics</Value>
- </Resource>
- <Resource Name="Admin.Settings.GeneralCommon.GoogleAnalytics.help" Area="Admin">
- <Value>Please configure the settings: Configuration -&gt; Settings -&gt; General settings -&gt; Tab Google Analytics</Value>
- </Resource>
- <Resource Name="Admin.Settings.GeneralCommon.GoogleAnalytics.help2" Area="Admin">
- <Value>An error occurred, please check logs</Value>
- </Resource>
- <Resource Name="Admin.Settings.GeneralCommon.GoogleAnalytics_help1" Area="Admin">
- <Value>
- 1. Register a Google Analytics account. Keep in mind that you need to wait 24h before GA can obtain some data to display.
- </Value>
- </Resource>
- <Resource Name="Admin.Settings.GeneralCommon.GoogleAnalytics_help2" Area="Admin">
- <Value>
- 2. Go to https://console.cloud.google.com/apis/credentials &gt; select credentials for your project &gt; New Credentials &gt; Service account key &gt; download a .json file from your account, and open it with text editor.
- </Value>
- </Resource>
- <Resource Name="Admin.Settings.GeneralCommon.GoogleAnalytics_help3" Area="Admin">
- <Value>
- 3. Copy the value of "private_key" e.g. -----BEGIN PRIVATE KEY-----\n ... -----END PRIVATE KEY-----\n
- </Value>
- </Resource>
- <Resource Name="Admin.Settings.GeneralCommon.GoogleAnalytics_help4" Area="Admin">
- <Value>
- 4. Copy the value of "client_email" e.g. [email protected]
- </Value>
- </Resource>
- <Resource Name="Admin.Settings.GeneralCommon.GoogleAnalytics_help5" Area="Admin">
- <Value>
- 5. Get your view ID, https://analytics.google.com/analytics/web/ &gt; Admin &gt; View Settings &gt; View ID. e.g. 412390048
- </Value>
- </Resource>
- <Resource Name="Admin.Settings.GeneralCommon.GoogleAnalytics_help6" Area="Admin">
- <Value>
- 6. Enable Google Analytics API in your Google Cloud Platform here - https://console.developers.google.com/apis/api/analyticsreporting.googleapis.com/
- </Value>
- </Resource>
- <Resource Name="Admin.Settings.GeneralCommon.GoogleAnalytics_help7" Area="Admin">
- <Value>
- 7. The last step is to add client email to your Google Analytics account.
- </Value>
- </Resource>
- <Resource Name="Admin.Settings.GeneralCommon.GoogleAnalyticsPrivateKey" Area="Admin">
- <Value>Private Key</Value>
- </Resource>
- <Resource Name="Admin.Settings.GeneralCommon.GoogleAnalyticsServiceAccountEmail" Area="Admin">
- <Value>Service AccountEmail</Value>
- </Resource>
- <Resource Name="Admin.Settings.GeneralCommon.GoogleAnalyticsViewID" Area="Admin">
- <Value>ViewID</Value>
- </Resource>
<Resource Name="Admin.Settings.GeneralCommon.InstagramLink" Area="Admin">
<Value>Instagram page URL</Value>
</Resource>