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 Payments.BrainTree - change type of project to Microsoft.NET.Sdk.Razor

KrzysztofPajakb2d9576859d5
diff --git a/src/Plugins/Payments.BrainTree/Controllers/PaymentBrainTreeController.cs b/src/Plugins/Payments.BrainTree/Areas/Admin/Controllers/PaymentBrainTreeController.cs
similarity index 97%
rename from src/Plugins/Payments.BrainTree/Controllers/PaymentBrainTreeController.cs
rename to src/Plugins/Payments.BrainTree/Areas/Admin/Controllers/PaymentBrainTreeController.cs
index 616cfb91f..a632418fd 100644
--- a/src/Plugins/Payments.BrainTree/Controllers/PaymentBrainTreeController.cs
+++ b/src/Plugins/Payments.BrainTree/Areas/Admin/Controllers/PaymentBrainTreeController.cs
@@ -52,7 +52,7 @@ namespace Payments.BrainTree.Controllers
DisplayOrder = _brainTreePaymentSettings.DisplayOrder
};
- return View("~/Plugins/Payments.BrainTree/Views/Configure.cshtml", model);
+ return View(model);
}
[HttpPost]
diff --git a/src/Plugins/Payments.BrainTree/Views/Configure.cshtml b/src/Plugins/Payments.BrainTree/Areas/Admin/Views/PaymentBrainTree/Configure.cshtml
similarity index 100%
rename from src/Plugins/Payments.BrainTree/Views/Configure.cshtml
rename to src/Plugins/Payments.BrainTree/Areas/Admin/Views/PaymentBrainTree/Configure.cshtml
diff --git a/src/Plugins/Payments.BrainTree/Areas/Admin/Views/_ViewImports.cshtml b/src/Plugins/Payments.BrainTree/Areas/Admin/Views/_ViewImports.cshtml
new file mode 100644
index 000000000..2fb08c043
--- /dev/null
+++ b/src/Plugins/Payments.BrainTree/Areas/Admin/Views/_ViewImports.cshtml
@@ -0,0 +1,8 @@
+@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
+@addTagHelper *, Grand.Web.Common
+@addTagHelper *, Grand.Web
+
+@using Microsoft.AspNetCore.Mvc.ViewFeatures
+@using Grand.Infrastructure.Extensions
+
+@inject Grand.Web.Common.Localization.LocService Loc
diff --git a/src/Plugins/Payments.BrainTree/Components/PaymentBrainTreeScripts.cs b/src/Plugins/Payments.BrainTree/Components/PaymentBrainTreeScripts.cs
index 12be71274..33b3a89e6 100644
--- a/src/Plugins/Payments.BrainTree/Components/PaymentBrainTreeScripts.cs
+++ b/src/Plugins/Payments.BrainTree/Components/PaymentBrainTreeScripts.cs
@@ -7,7 +7,7 @@ namespace Payments.BrainTree.Components
{
public IViewComponentResult Invoke()
{
- return View("~/Plugins/Payments.BrainTree/Views/PaymentPaymentBrainTreeScripts.cshtml");
+ return View();
}
}
}
diff --git a/src/Plugins/Payments.BrainTree/Components/PaymentBrainTreeViewComponent.cs b/src/Plugins/Payments.BrainTree/Components/PaymentBrainTreeViewComponent.cs
index 627e5ed57..1ea19bddf 100644
--- a/src/Plugins/Payments.BrainTree/Components/PaymentBrainTreeViewComponent.cs
+++ b/src/Plugins/Payments.BrainTree/Components/PaymentBrainTreeViewComponent.cs
@@ -65,7 +65,7 @@ namespace Payments.BrainTree.Components
ViewBag.ClientToken = gateway.ClientToken.Generate();
ViewBag.OrderTotal = (await _orderTotalCalculationService.GetShoppingCartTotal(cart)).shoppingCartTotal;
- return View("~/Plugins/Payments.BrainTree/Views/PaymentInfo_3DS.cshtml", model);
+ return View(this.GetViewPath("PaymentInfo_3DS"), model);
}
//years
@@ -92,7 +92,7 @@ namespace Payments.BrainTree.Components
//set postback values (we cannot access "Form" with "GET" requests)
if (Request.Method == WebRequestMethods.Http.Get)
- return View("~/Plugins/Payments.BrainTree/Views/PaymentInfo.cshtml", model);
+ return View(this.GetViewPath("PaymentInfo"), model);
var form = await HttpContext.Request.ReadFormAsync();
@@ -117,8 +117,7 @@ namespace Payments.BrainTree.Components
select error.ErrorMessage;
model.Errors = string.Join(", ", query);
}
-
- return View("~/Plugins/Payments.BrainTree/Views/PaymentInfo.cshtml", model);
+ return View(this.GetViewPath("PaymentInfo"), model);
}
}
}
\ No newline at end of file
diff --git a/src/Plugins/Payments.BrainTree/Payments.BrainTree.csproj b/src/Plugins/Payments.BrainTree/Payments.BrainTree.csproj
index e2ce318f5..83b6a524a 100644
--- a/src/Plugins/Payments.BrainTree/Payments.BrainTree.csproj
+++ b/src/Plugins/Payments.BrainTree/Payments.BrainTree.csproj
@@ -1,8 +1,10 @@
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<PackageProjectUrl>https://grandnode.com/</PackageProjectUrl>
+ <Company>UNIT-SOFT Sp. z o.o.</Company>
+ <AddRazorSupportForMvc>true</AddRazorSupportForMvc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@@ -82,21 +84,6 @@
<None Update="logo.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Update="Views\Configure.cshtml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Update="Views\PaymentPaymentBrainTreeScripts.cshtml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Update="Views\PaymentInfo.cshtml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Update="Views\PaymentInfo_3DS.cshtml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Update="Views\_ViewImports.cshtml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
</ItemGroup>
</Project>
diff --git a/src/Plugins/Payments.BrainTree/Views/PaymentInfo.cshtml b/src/Plugins/Payments.BrainTree/Views/Shared/Components/PaymentBrainTree/PaymentInfo.cshtml
similarity index 100%
rename from src/Plugins/Payments.BrainTree/Views/PaymentInfo.cshtml
rename to src/Plugins/Payments.BrainTree/Views/Shared/Components/PaymentBrainTree/PaymentInfo.cshtml
diff --git a/src/Plugins/Payments.BrainTree/Views/PaymentInfo_3DS.cshtml b/src/Plugins/Payments.BrainTree/Views/Shared/Components/PaymentBrainTree/PaymentInfo_3DS.cshtml
similarity index 100%
rename from src/Plugins/Payments.BrainTree/Views/PaymentInfo_3DS.cshtml
rename to src/Plugins/Payments.BrainTree/Views/Shared/Components/PaymentBrainTree/PaymentInfo_3DS.cshtml
diff --git a/src/Plugins/Payments.BrainTree/Views/PaymentPaymentBrainTreeScripts.cshtml b/src/Plugins/Payments.BrainTree/Views/Shared/Components/PaymentBrainTreeScripts/Default.cshtml
similarity index 100%
rename from src/Plugins/Payments.BrainTree/Views/PaymentPaymentBrainTreeScripts.cshtml
rename to src/Plugins/Payments.BrainTree/Views/Shared/Components/PaymentBrainTreeScripts/Default.cshtml