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.

Plugin Payment.CachOnDelivery - change type of project to Microsoft.NET.Sdk.Razor

KrzysztofPajak3e881a8c5940
diff --git a/src/Plugins/Payments.CashOnDelivery/Controllers/PaymentCashOnDeliveryController.cs b/src/Plugins/Payments.CashOnDelivery/Areas/Admin/Controllers/PaymentCashOnDeliveryController.cs
similarity index 89%
rename from src/Plugins/Payments.CashOnDelivery/Controllers/PaymentCashOnDeliveryController.cs
rename to src/Plugins/Payments.CashOnDelivery/Areas/Admin/Controllers/PaymentCashOnDeliveryController.cs
index 74b9f17bd..258526d22 100644
--- a/src/Plugins/Payments.CashOnDelivery/Controllers/PaymentCashOnDeliveryController.cs
+++ b/src/Plugins/Payments.CashOnDelivery/Areas/Admin/Controllers/PaymentCashOnDeliveryController.cs
@@ -1,14 +1,13 @@
-using Grand.Business.Common.Extensions;
-using Grand.Business.Common.Interfaces.Configuration;
+using Grand.Business.Common.Interfaces.Configuration;
using Grand.Business.Common.Interfaces.Localization;
using Grand.Business.Common.Interfaces.Stores;
using Grand.Business.Common.Services.Security;
-using Grand.Web.Common.Controllers;
-using Grand.Web.Common.Filters;
-using Grand.Web.Common.Security.Authorization;
using Grand.Domain.Common;
using Grand.Domain.Customers;
using Grand.Infrastructure;
+using Grand.Web.Common.Controllers;
+using Grand.Web.Common.Filters;
+using Grand.Web.Common.Security.Authorization;
using Microsoft.AspNetCore.Mvc;
using Payments.CashOnDelivery.Models;
using System.Linq;
@@ -25,20 +24,17 @@ namespace Payments.CashOnDelivery.Controllers
private readonly IStoreService _storeService;
private readonly ISettingService _settingService;
private readonly ITranslationService _translationService;
- private readonly ILanguageService _languageService;
public PaymentCashOnDeliveryController(IWorkContext workContext,
IStoreService storeService,
ISettingService settingService,
- ITranslationService translationService,
- ILanguageService languageService)
+ ITranslationService translationService)
{
_workContext = workContext;
_storeService = storeService;
_settingService = settingService;
_translationService = translationService;
- _languageService = languageService;
}
@@ -60,8 +56,7 @@ namespace Payments.CashOnDelivery.Controllers
var storeScope = await this.GetActiveStore(_storeService, _workContext);
var cashOnDeliveryPaymentSettings = _settingService.LoadSetting<CashOnDeliveryPaymentSettings>(storeScope);
- var model = new ConfigurationModel
- {
+ var model = new ConfigurationModel {
DescriptionText = cashOnDeliveryPaymentSettings.DescriptionText,
AdditionalFee = cashOnDeliveryPaymentSettings.AdditionalFee,
AdditionalFeePercentage = cashOnDeliveryPaymentSettings.AdditionalFeePercentage,
@@ -72,7 +67,7 @@ namespace Payments.CashOnDelivery.Controllers
model.ActiveStore = storeScope;
- return View("~/Plugins/Payments.CashOnDelivery/Views/PaymentCashOnDelivery/Configure.cshtml", model);
+ return View(model);
}
[HttpPost]
diff --git a/src/Plugins/Payments.CashOnDelivery/Views/PaymentCashOnDelivery/Configure.cshtml b/src/Plugins/Payments.CashOnDelivery/Areas/Admin/Views/PaymentCashOnDelivery/Configure.cshtml
similarity index 100%
rename from src/Plugins/Payments.CashOnDelivery/Views/PaymentCashOnDelivery/Configure.cshtml
rename to src/Plugins/Payments.CashOnDelivery/Areas/Admin/Views/PaymentCashOnDelivery/Configure.cshtml
diff --git a/src/Plugins/Payments.CashOnDelivery/Views/PaymentCashOnDelivery/_ViewImports.cshtml b/src/Plugins/Payments.CashOnDelivery/Areas/Admin/Views/_ViewImports.cshtml
similarity index 100%
rename from src/Plugins/Payments.CashOnDelivery/Views/PaymentCashOnDelivery/_ViewImports.cshtml
rename to src/Plugins/Payments.CashOnDelivery/Areas/Admin/Views/_ViewImports.cshtml
diff --git a/src/Plugins/Payments.CashOnDelivery/Areas/Admin/Views/_ViewStart.cshtml b/src/Plugins/Payments.CashOnDelivery/Areas/Admin/Views/_ViewStart.cshtml
new file mode 100644
index 000000000..f5d9339f9
--- /dev/null
+++ b/src/Plugins/Payments.CashOnDelivery/Areas/Admin/Views/_ViewStart.cshtml
@@ -0,0 +1,3 @@
+@{
+ Layout = "";
+}
diff --git a/src/Plugins/Payments.CashOnDelivery/Components/PaymentCashOnDeliveryViewComponent.cs b/src/Plugins/Payments.CashOnDelivery/Components/PaymentCashOnDeliveryViewComponent.cs
index 375cb2ccc..ab92a1ac7 100644
--- a/src/Plugins/Payments.CashOnDelivery/Components/PaymentCashOnDeliveryViewComponent.cs
+++ b/src/Plugins/Payments.CashOnDelivery/Components/PaymentCashOnDeliveryViewComponent.cs
@@ -1,10 +1,8 @@
-using Grand.Business.Common.Extensions;
-using Grand.Business.Common.Interfaces.Configuration;
-using Grand.Web.Common.Components;
+using Grand.Business.Common.Interfaces.Configuration;
using Grand.Infrastructure;
+using Grand.Web.Common.Components;
using Microsoft.AspNetCore.Mvc;
using Payments.CashOnDelivery.Models;
-using System.Threading.Tasks;
namespace Payments.CashOnDelivery.Components
{
@@ -25,11 +23,10 @@ namespace Payments.CashOnDelivery.Components
{
var cashOnDeliveryPaymentSettings = _settingService.LoadSetting<CashOnDeliveryPaymentSettings>(_workContext.CurrentStore.Id);
- var model = new PaymentInfoModel
- {
+ var model = new PaymentInfoModel {
DescriptionText = cashOnDeliveryPaymentSettings.DescriptionText
};
- return View("~/Plugins/Payments.CashOnDelivery/Views/PaymentCashOnDelivery/PaymentInfo.cshtml", model);
+ return View(this.GetViewPath(), model);
}
}
}
\ No newline at end of file
diff --git a/src/Plugins/Payments.CashOnDelivery/Payments.CashOnDelivery.csproj b/src/Plugins/Payments.CashOnDelivery/Payments.CashOnDelivery.csproj
index e2e622abb..aec50b337 100644
--- a/src/Plugins/Payments.CashOnDelivery/Payments.CashOnDelivery.csproj
+++ b/src/Plugins/Payments.CashOnDelivery/Payments.CashOnDelivery.csproj
@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
@@ -7,6 +7,7 @@
<Copyright>Copyright © UNIT-SOFT Sp. z o.o.</Copyright>
<PackageProjectUrl>https://grandnode.com/</PackageProjectUrl>
<TieredCompilation>true</TieredCompilation>
+ <AddRazorSupportForMvc>true</AddRazorSupportForMvc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
@@ -73,15 +74,6 @@
<None Update="logo.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
- <None Update="Views\PaymentCashOnDelivery\Configure.cshtml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Update="Views\PaymentCashOnDelivery\PaymentInfo.cshtml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Update="Views\PaymentCashOnDelivery\_ViewImports.cshtml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
</ItemGroup>
</Project>
\ No newline at end of file
diff --git a/src/Plugins/Payments.CashOnDelivery/Views/PaymentCashOnDelivery/PaymentInfo.cshtml b/src/Plugins/Payments.CashOnDelivery/Views/Shared/Components/PaymentCashOnDelivery/Default.cshtml
similarity index 100%
rename from src/Plugins/Payments.CashOnDelivery/Views/PaymentCashOnDelivery/PaymentInfo.cshtml
rename to src/Plugins/Payments.CashOnDelivery/Views/Shared/Components/PaymentCashOnDelivery/Default.cshtml