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.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
Grand.Web - add new attribute IgnoreApi / Set HttpGet attribute to Actions
support791cf2bf7426
diff --git a/src/API/Grand.Api/Controllers/TokenWebController.cs b/src/API/Grand.Api/Controllers/TokenWebController.csindex e5618b023..aa42e23f1 100644--- a/src/API/Grand.Api/Controllers/TokenWebController.cs+++ b/src/API/Grand.Api/Controllers/TokenWebController.cs@@ -11,6 +11,7 @@ using MediatR;using Microsoft.AspNetCore.Antiforgery;using Microsoft.AspNetCore.Authorization;using Microsoft.AspNetCore.Mvc;+using Swashbuckle.AspNetCore.Annotations;using System.Security.Claims;namespace Grand.Api.Controllers@@ -18,6 +19,7 @@ namespace Grand.Api.Controllers[ApiExplorerSettings(GroupName = "v2")][ApiController][Route("[controller]/[action]")]+ [SwaggerTag(description: "Create token")]public class TokenWebController : ControllerBase{private readonly ICustomerService _customerService;diff --git a/src/Web/Grand.Web.Common/Attributes/IgnoreApiAttribute.cs b/src/Web/Grand.Web.Common/Attributes/IgnoreApiAttribute.csnew file mode 100644index 000000000..31e9c8e28--- /dev/null+++ b/src/Web/Grand.Web.Common/Attributes/IgnoreApiAttribute.cs@@ -0,0 +1,6 @@+namespace Grand.Web.Common.Attributes;++[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]+public class IgnoreApiAttribute : Attribute+{+}\ No newline at end of filediff --git a/src/Web/Grand.Web/Controllers/AccountController.cs b/src/Web/Grand.Web/Controllers/AccountController.csindex 21876bf61..883329fe2 100644--- a/src/Web/Grand.Web/Controllers/AccountController.cs+++ b/src/Web/Grand.Web/Controllers/AccountController.cs@@ -13,6 +13,7 @@ using Grand.Domain.Stores;using Grand.Infrastructure;using Grand.Infrastructure.Extensions;using Grand.Web.Commands.Models.Customers;+using Grand.Web.Common.Attributes;using Grand.Web.Common.Controllers;using Grand.Web.Common.Filters;using Grand.Web.Common.Security.Captcha;@@ -83,6 +84,7 @@ namespace Grand.Web.Controllers//available even when navigation is not allowed[PublicStore(true)][ClosedStore(true)]+ [IgnoreApi]public virtual IActionResult Login(bool? checkoutAsGuest){var model = new LoginModel {@@ -98,6 +100,7 @@ namespace Grand.Web.Controllers[PublicStore(true)][ClosedStore(true)][AutoValidateAntiforgeryToken]+ [IgnoreApi]public virtual async Task<IActionResult> Login(LoginModel model, string returnUrl){if (ModelState.IsValid)@@ -130,7 +133,7 @@ namespace Grand.Web.Controllersreturn View(model);}-+ [IgnoreApi]public async Task<IActionResult> TwoFactorAuthorization(){if (!_customerSettings.TwoFactorAuthenticationEnabled)@@ -160,7 +163,7 @@ namespace Grand.Web.Controllersreturn View();}-+ [IgnoreApi][HttpPost]public async Task<IActionResult> TwoFactorAuthorization(string token,[FromServices] ITwoFactorAuthenticationService twoFactorAuthenticationService)@@ -204,7 +207,7 @@ namespace Grand.Web.Controllersreturn View();}-+ [IgnoreApi]private async Task<IActionResult> SignInAction(Customer customer, bool createPersistentCookie = false,string returnUrl = null){@@ -224,6 +227,7 @@ namespace Grand.Web.Controllers[ClosedStore(true)]//available even when navigation is not allowed[PublicStore(true)]+ [IgnoreApi]public virtual async Task<IActionResult> Logout([FromServices] StoreInformationSettings storeInformationSettings){@@ -326,6 +330,7 @@ namespace Grand.Web.Controllers//available even when navigation is not allowed[PublicStore(true)]+ [HttpGet]public virtual async Task<IActionResult> Register(){//check whether registration is allowed@@ -452,6 +457,8 @@ namespace Grand.Web.Controllers//available even when navigation is not allowed[PublicStore(true)]+ [IgnoreApi]+ [HttpGet]public virtual IActionResult RegisterResult(int resultId){var resultText = "";@@ -506,6 +513,7 @@ namespace Grand.Web.Controllers}//available even when navigation is not allowed+ [HttpGet][PublicStore(true)]public virtual async Task<IActionResult> AccountActivation(string token, string email){@@ -540,7 +548,8 @@ namespace Grand.Web.Controllers#endregion#region My account / Info-++ [HttpGet]public virtual async Task<IActionResult> Info(){if (!await _groupService.IsRegistered(_workContext.CurrentCustomer))@@ -617,7 +626,8 @@ namespace Grand.Web.Controllersredirect = Url.Action("Info")});}-++ [HttpGet]public virtual async Task<IActionResult> Export(){if (!await _groupService.IsRegistered(_workContext.CurrentCustomer))@@ -635,6 +645,7 @@ namespace Grand.Web.Controllers#region My account / Addresses+ [HttpGet]public virtual async Task<IActionResult> Addresses(){if (!await _groupService.IsRegistered(_workContext.CurrentCustomer))@@ -670,7 +681,7 @@ namespace Grand.Web.Controllersredirect = Url.RouteUrl("CustomerAddresses")});}-+ [HttpGet]public virtual async Task<IActionResult> AddressAdd(){if (!await _groupService.IsRegistered(_workContext.CurrentCustomer))@@ -733,7 +744,7 @@ namespace Grand.Web.Controllersreturn View(model);}-+ [HttpGet]public virtual async Task<IActionResult> AddressEdit(string addressId){if (!await _groupService.IsRegistered(_workContext.CurrentCustomer))@@ -813,7 +824,7 @@ namespace Grand.Web.Controllers#endregion#region My account / Downloadable products-+ [HttpGet]public virtual async Task<IActionResult> DownloadableProducts(){if (!await _groupService.IsRegistered(_workContext.CurrentCustomer))@@ -828,7 +839,7 @@ namespace Grand.Web.Controllers});return View(model);}-+ [HttpGet]public virtual async Task<IActionResult> UserAgreement(Guid orderItemId){var model = await _mediator.Send(new GetUserAgreement { OrderItemId = orderItemId });@@ -838,7 +849,7 @@ namespace Grand.Web.Controllers#endregion#region My account / Change password-+ [HttpGet]public virtual async Task<IActionResult> ChangePassword(){if (!await _groupService.IsRegistered(_workContext.CurrentCustomer))@@ -876,7 +887,7 @@ namespace Grand.Web.Controllers#endregion#region My account / Delete account-+ [HttpGet]public virtual async Task<IActionResult> DeleteAccount(){if (!await _groupService.IsRegistered(_workContext.CurrentCustomer))@@ -921,7 +932,7 @@ namespace Grand.Web.Controllers#endregion#region My account / Auctions-+ [HttpGet]public virtual async Task<IActionResult> Auctions(){if (!await _groupService.IsRegistered(_workContext.CurrentCustomer))@@ -939,7 +950,7 @@ namespace Grand.Web.Controllers#endregion#region My account / Notes-+ [HttpGet]public virtual async Task<IActionResult> Notes(){if (!await _groupService.IsRegistered(_workContext.CurrentCustomer))@@ -956,7 +967,7 @@ namespace Grand.Web.Controllers#endregion#region My account / Documents-+ [HttpGet]public virtual async Task<IActionResult> Documents(DocumentPagingModel command){if (!await _groupService.IsRegistered(_workContext.CurrentCustomer))@@ -977,7 +988,7 @@ namespace Grand.Web.Controllers#endregion#region My account / Reviews-+ [HttpGet]public virtual async Task<IActionResult> Reviews(){if (!await _groupService.IsRegistered(_workContext.CurrentCustomer))@@ -995,7 +1006,7 @@ namespace Grand.Web.Controllers#endregion#region My account / TwoFactorAuth-+ [HttpGet]public async Task<IActionResult> EnableTwoFactorAuthenticator(){if (!await _groupService.IsRegistered(_workContext.CurrentCustomer))@@ -1056,7 +1067,7 @@ namespace Grand.Web.Controllersreturn View(model);}-+ [HttpGet]public async Task<IActionResult> DisableTwoFactorAuthenticator(){if (!await _groupService.IsRegistered(_workContext.CurrentCustomer))@@ -1128,7 +1139,7 @@ namespace Grand.Web.Controllers#endregion#region My account / Courses-+ [HttpGet]public virtual async Task<IActionResult> Courses(){if (!await _groupService.IsRegistered(_workContext.CurrentCustomer))@@ -1146,7 +1157,7 @@ namespace Grand.Web.Controllers#endregion#region My account / Sub accounts-+ [HttpGet]public virtual async Task<IActionResult> SubAccounts(){if (!await _groupService.IsRegistered(_workContext.CurrentCustomer))@@ -1162,7 +1173,7 @@ namespace Grand.Web.Controllersreturn View(model);}-+ [HttpGet]public virtual async Task<IActionResult> SubAccountAdd(){if (!await _groupService.IsRegistered(_workContext.CurrentCustomer))@@ -1197,7 +1208,7 @@ namespace Grand.Web.Controllersreturn RedirectToRoute("CustomerSubAccounts");}-+ [HttpGet]public virtual async Task<IActionResult> SubAccountEdit(string id){if (!await _groupService.IsRegistered(_workContext.CurrentCustomer))diff --git a/src/Web/Grand.Web/Controllers/CatalogController.cs b/src/Web/Grand.Web/Controllers/CatalogController.csindex 4af8ba2ba..2cdafde34 100644--- a/src/Web/Grand.Web/Controllers/CatalogController.cs+++ b/src/Web/Grand.Web/Controllers/CatalogController.cs@@ -103,7 +103,7 @@ namespace Grand.Web.Controllers#endregion#region Categories-+ [HttpGet]public virtual async Task<IActionResult> Category(string categoryId, CatalogPagingFilteringModel command){var category = await _categoryService.GetCategoryById(categoryId);@@ -156,7 +156,7 @@ namespace Grand.Web.Controllers#endregion#region Brands-+ [HttpGet]public virtual async Task<IActionResult> Brand(string brandId, CatalogPagingFilteringModel command){var brand = await _brandService.GetBrandById(brandId);@@ -205,7 +205,7 @@ namespace Grand.Web.Controllersreturn View(layoutViewPath, model);}-+ [HttpGet]public virtual async Task<IActionResult> BrandAll(){var model = await _mediator.Send(new GetBrandAll {@@ -219,7 +219,7 @@ namespace Grand.Web.Controllers#endregion#region Collections-+ [HttpGet]public virtual async Task<IActionResult> Collection(string collectionId, CatalogPagingFilteringModel command){var collection = await _collectionService.GetCollectionById(collectionId);@@ -268,7 +268,7 @@ namespace Grand.Web.Controllersreturn View(layoutViewPath, model);}-+ [HttpGet]public virtual async Task<IActionResult> CollectionAll(){var model = await _mediator.Send(new GetCollectionAll {@@ -282,7 +282,7 @@ namespace Grand.Web.Controllers#endregion#region Vendors-+ [HttpGet]public virtual async Task<IActionResult> Vendor(string vendorId, CatalogPagingFilteringModel command){var vendor = await _vendorService.GetVendorById(vendorId);@@ -314,7 +314,7 @@ namespace Grand.Web.Controllersreturn View(model);}-+ [HttpGet]public virtual async Task<IActionResult> VendorAll(){//we don't allow viewing of vendors if "vendors" block is hidden@@ -425,7 +425,7 @@ namespace Grand.Web.Controllers#endregion#region Product tags-+ [HttpGet]public virtual async Task<IActionResult> ProductsByTag(string productTagId, CatalogPagingFilteringModel command, [FromServices] IProductTagService productTagService){var productTag = await productTagService.GetProductTagById(productTagId);@@ -441,6 +441,7 @@ namespace Grand.Web.Controllers});return View(model);}+ [HttpGet]public virtual async Task<IActionResult> ProductsByTagName(string seName, CatalogPagingFilteringModel command, [FromServices] IProductTagService productTagService){var productTag = await productTagService.GetProductTagBySeName(seName);@@ -456,7 +457,7 @@ namespace Grand.Web.Controllers});return View("ProductsByTag", model);}-+ [HttpGet]public virtual async Task<IActionResult> ProductTagsAll(){var model = await _mediator.Send(new GetProductTagsAll {@@ -469,7 +470,7 @@ namespace Grand.Web.Controllers#endregion#region Searching-+ [HttpGet]public virtual async Task<IActionResult> Search(SearchModel model, CatalogPagingFilteringModel command){//'Continue shopping' URL@@ -492,7 +493,7 @@ namespace Grand.Web.Controllers});return View(searchModel);}-+ [HttpGet]public virtual async Task<IActionResult> SearchTermAutoComplete(string term, string categoryId, [FromServices] CatalogSettings catalogSettings){if (string.IsNullOrWhiteSpace(term) || term.Length < catalogSettings.ProductSearchTermMinimumLength)diff --git a/src/Web/Grand.Web/Controllers/CheckoutController.cs b/src/Web/Grand.Web/Controllers/CheckoutController.csindex 0e7a4a65e..12d15bae6 100644--- a/src/Web/Grand.Web/Controllers/CheckoutController.cs+++ b/src/Web/Grand.Web/Controllers/CheckoutController.cs@@ -336,6 +336,7 @@ namespace Grand.Web.Controllers}#endregion+ [HttpGet]public virtual async Task<IActionResult> Index(){var customer = _workContext.CurrentCustomer;@@ -373,7 +374,7 @@ namespace Grand.Web.Controllersreturn RedirectToRoute("Checkout");}-+ [HttpGet]public virtual async Task<IActionResult> Start(){//validation@@ -777,7 +778,7 @@ namespace Grand.Web.Controllersreturn Json(new { error = 1, message = exc.Message });}}-+ [HttpGet]public virtual async Task<IActionResult> GetShippingFormPartialView(string shippingOption){var routeName = await GetShippingComputation(shippingOption).GetControllerRouteName();@@ -921,7 +922,7 @@ namespace Grand.Web.Controllersreturn Json(new { error = 1, message = exc.Message });}}-+ [HttpGet]public virtual async Task<IActionResult> Completed(string orderId){//validation@@ -958,7 +959,7 @@ namespace Grand.Web.Controllersreturn View(model);}-+ [HttpGet]public virtual async Task<IActionResult> ConfirmOrder(){try@@ -1031,7 +1032,7 @@ namespace Grand.Web.Controllersreturn Json(new { error = 1, message = exc.Message });}}-+ [HttpGet]public virtual async Task<IActionResult> CompleteRedirectionPayment(string paymentTransactionId){trydiff --git a/src/Web/Grand.Web/Controllers/CommonController.cs b/src/Web/Grand.Web/Controllers/CommonController.csindex 4eb531da7..da1f781b0 100644--- a/src/Web/Grand.Web/Controllers/CommonController.cs+++ b/src/Web/Grand.Web/Controllers/CommonController.cs@@ -10,6 +10,7 @@ using Grand.Domain.Tax;using Grand.Infrastructure;using Grand.Infrastructure.Configuration;using Grand.Web.Commands.Models.Customers;+using Grand.Web.Common.Attributes;using Grand.Web.Common.Controllers;using Grand.Web.Common.Filters;using Grand.Web.Common.Themes;@@ -98,6 +99,8 @@ namespace Grand.Web.Controllers#region Methods//page not found+ [IgnoreApi]+ [HttpGet]public virtual IActionResult PageNotFound(){Response.StatusCode = 404;@@ -106,13 +109,16 @@ namespace Grand.Web.Controllers}//access denied+ [IgnoreApi]+ [HttpGet]public virtual IActionResult AccessDenied(){Response.StatusCode = 403;Response.ContentType = "text/html";return View();}-+ [IgnoreApi]+ [HttpGet]public virtual IActionResult Route(string routeName){if (string.IsNullOrEmpty(routeName))@@ -124,11 +130,13 @@ namespace Grand.Web.Controllers}//external authentication error+ [IgnoreApi]+ [HttpGet]public virtual IActionResult ExternalAuthenticationError(IEnumerable<string> errors){return View(errors);}-+ [HttpGet][PublicStore(true)][DenySystemAccount]public virtual async Task<IActionResult> SetLanguage(@@ -166,6 +174,8 @@ namespace Grand.Web.Controllers}//Use in SlugRouteTransformer.+ [IgnoreApi]+ [HttpGet]public virtual IActionResult InternalRedirect(string url, bool permanentRedirect){//ensure it's invoked from our GenericPathRoute class@@ -197,6 +207,7 @@ namespace Grand.Web.Controllers[DenySystemAccount][PublicStore(true)]+ [HttpGet]public virtual async Task<IActionResult> SetCurrency([FromServices] ICurrencyService currencyService,[FromServices] IUserFieldService userFieldService,@@ -229,6 +240,7 @@ namespace Grand.Web.Controllers[DenySystemAccount]//available even when navigation is not allowed[PublicStore(true)]+ [HttpGet]public virtual async Task<IActionResult> SetStore([FromServices] IStoreService storeService,[FromServices] IStoreHelper storeHelper,@@ -270,6 +282,7 @@ namespace Grand.Web.Controllers[DenySystemAccount]//available even when navigation is not allowed[PublicStore(true)]+ [HttpGet]public virtual async Task<IActionResult> SetTaxType(int customerTaxType, string returnUrl = default){var taxDisplayType = (TaxDisplayType)Enum.ToObject(typeof(TaxDisplayType), customerTaxType);@@ -290,6 +303,7 @@ namespace Grand.Web.Controllers}[DenySystemAccount]+ [HttpGet]public virtual async Task<IActionResult> SetStoreTheme([FromServices] IThemeContext themeContext, string themeName, string returnUrl = ""){@@ -310,6 +324,7 @@ namespace Grand.Web.Controllers}//sitemap page+ [HttpGet]public virtual async Task<IActionResult> Sitemap([FromServices] CommonSettings commonSettings){if (!commonSettings.SitemapEnabled)@@ -355,6 +370,7 @@ namespace Grand.Web.Controllers[ClosedStore(true)][PublicStore(true)]+ [HttpGet]public virtual async Task<IActionResult> PrivacyPreference([FromServices] StoreInformationSettingsstoreInformationSettings){@@ -411,12 +427,13 @@ namespace Grand.Web.Controllers//robots.txt file[ClosedStore(true)][PublicStore(true)]+ [HttpGet]public virtual async Task<IActionResult> RobotsTextFile(){var sb = await _mediator.Send(new GetRobotsTextFile { StoreId = _workContext.CurrentStore.Id });return Content(sb, "text/plain");}-+ [HttpGet]public virtual IActionResult GenericUrl(){//not found@@ -425,6 +442,8 @@ namespace Grand.Web.Controllers[ClosedStore(true)][PublicStore(true)]+ [IgnoreApi]+ [HttpGet]public virtual IActionResult StoreClosed(){return View();diff --git a/src/Web/Grand.Web/Controllers/CountryController.cs b/src/Web/Grand.Web/Controllers/CountryController.csindex 4e9cd452c..b6e917912 100644--- a/src/Web/Grand.Web/Controllers/CountryController.cs+++ b/src/Web/Grand.Web/Controllers/CountryController.cs@@ -31,6 +31,7 @@ namespace Grand.Web.Controllers//available even when navigation is not allowed[PublicStore(true)]+ [HttpGet]public virtual async Task<IActionResult> GetStatesByCountryId(string countryId, bool addSelectStateItem){//this action method gets called via an ajax requestdiff --git a/src/Web/Grand.Web/Controllers/CourseController.cs b/src/Web/Grand.Web/Controllers/CourseController.csindex 592cebf54..ca6cf5ae6 100644--- a/src/Web/Grand.Web/Controllers/CourseController.cs+++ b/src/Web/Grand.Web/Controllers/CourseController.cs@@ -79,7 +79,7 @@ namespace Grand.Web.Controllers//Store access_aclService.Authorize(course, _workContext.CurrentStore.Id);}-+ [HttpGet]public virtual async Task<IActionResult> Details(string courseId){var customer = _workContext.CurrentCustomer;@@ -109,6 +109,7 @@ namespace Grand.Web.Controllersreturn View(model);}+ [HttpGet]public virtual async Task<IActionResult> Lesson(string id){var customer = _workContext.CurrentCustomer;@@ -143,6 +144,7 @@ namespace Grand.Web.Controllersreturn View(model);}+ [HttpGet]public virtual async Task<IActionResult> DownloadFile(string id){var customer = _workContext.CurrentCustomer;@@ -177,7 +179,7 @@ namespace Grand.Web.ControllersFileDownloadName = fileName + download.Extension};}-+ [HttpGet]public virtual async Task<IActionResult> VideoFile(string id){var customer = _workContext.CurrentCustomer;@@ -212,7 +214,7 @@ namespace Grand.Web.ControllersFileDownloadName = fileName + download.Extension};}-+ [HttpGet]public virtual async Task<IActionResult> Approved(string id){var customer = _workContext.CurrentCustomer;diff --git a/src/Web/Grand.Web/Controllers/DownloadController.cs b/src/Web/Grand.Web/Controllers/DownloadController.csindex 14237dc7f..a3694e476 100644--- a/src/Web/Grand.Web/Controllers/DownloadController.cs+++ b/src/Web/Grand.Web/Controllers/DownloadController.cs@@ -45,7 +45,7 @@ namespace Grand.Web.Controllers_translationService = translationService;_customerSettings = customerSettings;}-+ [HttpGet]public virtual async Task<IActionResult> Sample(string productId){var product = await _productService.GetProductById(productId);@@ -69,7 +69,7 @@ namespace Grand.Web.Controllersvar contentType = !string.IsNullOrWhiteSpace(download.ContentType) ? download.ContentType : "application/octet-stream";return new FileContentResult(download.DownloadBinary, contentType) { FileDownloadName = fileName + download.Extension };}-+ [HttpGet]public virtual async Task<IActionResult> GetDownload(Guid orderItemId, bool agree = false){var orderItem = await _orderService.GetOrderItemByGuid(orderItemId);@@ -167,7 +167,7 @@ namespace Grand.Web.Controllers}return File(memoryStream.ToArray(), "application/zip", $"{Regex.Replace(product.Name, "[^A-Za-z0-9 _]", "")}.zip");}-+ [HttpGet]public virtual async Task<IActionResult> GetLicense(Guid orderItemId){var orderItem = await _orderService.GetOrderItemByGuid(orderItemId);@@ -201,7 +201,7 @@ namespace Grand.Web.Controllersvar contentType = !string.IsNullOrWhiteSpace(download.ContentType) ? download.ContentType : "application/octet-stream";return new FileContentResult(download.DownloadBinary, contentType) { FileDownloadName = fileName + download.Extension };}-+ [HttpGet]public virtual async Task<IActionResult> GetFileUpload(Guid downloadId){var download = await _downloadService.GetDownloadByGuid(downloadId);@@ -220,7 +220,7 @@ namespace Grand.Web.Controllersvar contentType = !string.IsNullOrWhiteSpace(download.ContentType) ? download.ContentType : "application/octet-stream";return new FileContentResult(download.DownloadBinary, contentType) { FileDownloadName = fileName + download.Extension };}-+ [HttpGet]public virtual async Task<IActionResult> GetOrderNoteFile(string orderNoteId){var orderNote = await _orderService.GetOrderNote(orderNoteId);@@ -250,7 +250,7 @@ namespace Grand.Web.Controllersvar contentType = !string.IsNullOrWhiteSpace(download.ContentType) ? download.ContentType : "application/octet-stream";return new FileContentResult(download.DownloadBinary, contentType) { FileDownloadName = fileName + download.Extension };}-+ [HttpGet]public virtual async Task<IActionResult> GetShipmentNoteFile(string shipmentNoteId,[FromServices] IShipmentService shipmentService){@@ -285,7 +285,7 @@ namespace Grand.Web.Controllersvar contentType = !string.IsNullOrWhiteSpace(download.ContentType) ? download.ContentType : "application/octet-stream";return new FileContentResult(download.DownloadBinary, contentType) { FileDownloadName = fileName + download.Extension };}-+ [HttpGet]public virtual async Task<IActionResult> GetCustomerNoteFile(string customerNoteId,[FromServices] ICustomerNoteService customerNoteService){@@ -315,7 +315,7 @@ namespace Grand.Web.Controllersvar contentType = !string.IsNullOrWhiteSpace(download.ContentType) ? download.ContentType : "application/octet-stream";return new FileContentResult(download.DownloadBinary, contentType) { FileDownloadName = fileName + download.Extension };}-+ [HttpGet]public virtual async Task<IActionResult> GetMerchandiseReturnNoteFile(string merchandiseReturnNoteId){var merchandiseReturnNote = await _merchandiseReturnService.GetMerchandiseReturnNote(merchandiseReturnNoteId);@@ -345,7 +345,7 @@ namespace Grand.Web.Controllersvar contentType = !string.IsNullOrWhiteSpace(download.ContentType) ? download.ContentType : "application/octet-stream";return new FileContentResult(download.DownloadBinary, contentType) { FileDownloadName = fileName + download.Extension };}-+ [HttpGet]public virtual async Task<IActionResult> GetDocumentFile(string documentId,[FromServices] IDocumentService documentService){diff --git a/src/Web/Grand.Web/Controllers/HomeController.cs b/src/Web/Grand.Web/Controllers/HomeController.csindex 9e38b153d..6efd054b0 100644--- a/src/Web/Grand.Web/Controllers/HomeController.cs+++ b/src/Web/Grand.Web/Controllers/HomeController.cs@@ -1,10 +1,13 @@-using Grand.Web.Common.Controllers;+using Grand.Web.Common.Attributes;+using Grand.Web.Common.Controllers;using Microsoft.AspNetCore.Mvc;namespace Grand.Web.Controllers{public class HomeController : BasePublicController{+ [IgnoreApi]+ [HttpGet]public virtual IActionResult Index(){return View();diff --git a/src/Web/Grand.Web/Controllers/KnowledgebaseController.cs b/src/Web/Grand.Web/Controllers/KnowledgebaseController.csindex a811a87f7..75dbdc7fe 100644--- a/src/Web/Grand.Web/Controllers/KnowledgebaseController.cs+++ b/src/Web/Grand.Web/Controllers/KnowledgebaseController.cs@@ -67,7 +67,7 @@ namespace Grand.Web.Controllers_customerSettings = customerSettings;_permissionService = permissionService;}-+ [HttpGet]public virtual IActionResult List(){if (!_knowledgebaseSettings.Enabled)@@ -77,7 +77,7 @@ namespace Grand.Web.Controllersreturn View("List", model);}-+ [HttpGet]public virtual async Task<IActionResult> ArticlesByCategory(string categoryId){if (!_knowledgebaseSettings.Enabled)@@ -124,7 +124,7 @@ namespace Grand.Web.Controllersreturn View("List", model);}-+ [HttpGet]public virtual async Task<IActionResult> ItemsByKeyword(string keyword){if (!_knowledgebaseSettings.Enabled)@@ -163,7 +163,7 @@ namespace Grand.Web.Controllersreturn View("List", model);}-+ [HttpGet]public virtual async Task<IActionResult> KnowledgebaseArticle(string articleId, [FromServices] ICustomerService customerService){if (!_knowledgebaseSettings.Enabled)diff --git a/src/Web/Grand.Web/Controllers/MerchandiseReturnController.cs b/src/Web/Grand.Web/Controllers/MerchandiseReturnController.csindex 8a3080529..f47a6a105 100644--- a/src/Web/Grand.Web/Controllers/MerchandiseReturnController.cs+++ b/src/Web/Grand.Web/Controllers/MerchandiseReturnController.cs@@ -103,7 +103,7 @@ namespace Grand.Web.Controllers#endregion#region Methods-+ [HttpGet]public virtual async Task<IActionResult> CustomerMerchandiseReturns(){if (!await _groupService.IsRegistered(_workContext.CurrentCustomer))@@ -117,7 +117,7 @@ namespace Grand.Web.Controllersreturn View(model);}-+ [HttpGet]public virtual async Task<IActionResult> MerchandiseReturn(string orderId){var order = await _orderService.GetOrderById(orderId);@@ -179,7 +179,7 @@ namespace Grand.Web.Controllersreturn View(returnModel);}-+ [HttpGet]public virtual async Task<IActionResult> MerchandiseReturnDetails(string merchandiseReturnId){var rr = await _merchandiseReturnService.GetMerchandiseReturnById(merchandiseReturnId);diff --git a/src/Web/Grand.Web/Controllers/NewsController.cs b/src/Web/Grand.Web/Controllers/NewsController.csindex 33af8605b..c12e91239 100644--- a/src/Web/Grand.Web/Controllers/NewsController.cs+++ b/src/Web/Grand.Web/Controllers/NewsController.cs@@ -56,7 +56,7 @@ namespace Grand.Web.Controllers#endregion#region Methods-+ [HttpGet]public virtual async Task<IActionResult> List(NewsPagingFilteringModel command){if (!_newsSettings.Enabled)@@ -65,6 +65,7 @@ namespace Grand.Web.Controllersvar model = await _mediator.Send(new GetNewsItemList { Command = command });return View(model);}+ [HttpGet]public virtual async Task<IActionResult> NewsItem(string newsItemId){if (!_newsSettings.Enabled)diff --git a/src/Web/Grand.Web/Controllers/NewsletterController.cs b/src/Web/Grand.Web/Controllers/NewsletterController.csindex 3d2b7bf16..c9cfa8679 100644--- a/src/Web/Grand.Web/Controllers/NewsletterController.cs+++ b/src/Web/Grand.Web/Controllers/NewsletterController.cs@@ -50,7 +50,7 @@ namespace Grand.Web.Controllers});}-+ [HttpGet]public virtual async Task<IActionResult> SubscriptionActivation(Guid token, bool active){var model = await _mediator.Send(new SubscriptionActivationCommand { Active = active, Token = token });diff --git a/src/Web/Grand.Web/Controllers/OrderController.cs b/src/Web/Grand.Web/Controllers/OrderController.csindex 23b24ff67..cddcc826a 100644--- a/src/Web/Grand.Web/Controllers/OrderController.cs+++ b/src/Web/Grand.Web/Controllers/OrderController.cs@@ -80,6 +80,7 @@ namespace Grand.Web.Controllers#region Methods//My account / Orders+ [HttpGet]public virtual async Task<IActionResult> CustomerOrders(OrderPagingModel command){if (!await _groupService.IsRegistered(_workContext.CurrentCustomer))@@ -95,6 +96,7 @@ namespace Grand.Web.Controllers}//My account / Order details page+ [HttpGet]public virtual async Task<IActionResult> Details(string orderId){var order = await _orderService.GetOrderById(orderId);@@ -107,6 +109,7 @@ namespace Grand.Web.Controllers}//My account / Order details page / Print+ [HttpGet]public virtual async Task<IActionResult> PrintOrderDetails(string orderId){var order = await _orderService.GetOrderById(orderId);@@ -120,6 +123,7 @@ namespace Grand.Web.Controllers}//My account / Order details page / Cancel Unpaid Order+ [HttpGet]public virtual async Task<IActionResult> CancelOrder(string orderId){var order = await _orderService.GetOrderById(orderId);@@ -137,6 +141,7 @@ namespace Grand.Web.Controllers}//My account / Order details page / PDF invoice+ [HttpGet]public virtual async Task<IActionResult> GetPdfInvoice(string orderId, [FromServices] IPdfService pdfService){var order = await _orderService.GetOrderById(orderId);@@ -180,6 +185,7 @@ namespace Grand.Web.Controllers}//My account / Order details page / re-order+ [HttpGet]public virtual async Task<IActionResult> ReOrder(string orderId){var order = await _orderService.GetOrderById(orderId);@@ -221,6 +227,7 @@ namespace Grand.Web.Controllers}//My account / Order details page / Shipment details page+ [HttpGet]public virtual async Task<IActionResult> ShipmentDetails(string shipmentId, [FromServices] IShipmentService shipmentService){var shipment = await shipmentService.GetShipmentById(shipmentId);@@ -242,6 +249,7 @@ namespace Grand.Web.Controllers}//My account / Loyalty points+ [HttpGet]public virtual async Task<IActionResult> CustomerLoyaltyPoints([FromServices] LoyaltyPointsSettings loyaltyPointsSettings){if (!await _groupService.IsRegistered(_workContext.CurrentCustomer))diff --git a/src/Web/Grand.Web/Controllers/OutOfStockSubscriptionController.cs b/src/Web/Grand.Web/Controllers/OutOfStockSubscriptionController.csindex 54226a1d1..dfb0c239b 100644--- a/src/Web/Grand.Web/Controllers/OutOfStockSubscriptionController.cs+++ b/src/Web/Grand.Web/Controllers/OutOfStockSubscriptionController.cs@@ -61,7 +61,7 @@ namespace Grand.Web.Controllers#endregion#region Methods-+ [HttpGet]// Product details page > out of stock subscribe buttonpublic virtual async Task<IActionResult> SubscribeButton(string productId, string warehouseId){@@ -195,6 +195,7 @@ namespace Grand.Web.Controllers// My account / Out of stock subscriptions+ [HttpGet]public virtual async Task<IActionResult> CustomerSubscriptions(int? pageNumber){if (_customerSettings.HideOutOfStockSubscriptionsTab)diff --git a/src/Web/Grand.Web/Controllers/PageController.cs b/src/Web/Grand.Web/Controllers/PageController.csindex 832fcb8d1..199f93b33 100644--- a/src/Web/Grand.Web/Controllers/PageController.cs+++ b/src/Web/Grand.Web/Controllers/PageController.cs@@ -35,7 +35,7 @@ namespace Grand.Web.Controllers#endregion#region Methods-+ [HttpGet]public virtual async Task<IActionResult> PageDetails(string pageId){if (string.IsNullOrEmpty(pageId))@@ -61,7 +61,7 @@ namespace Grand.Web.Controllersreturn View(layoutViewPath, model);}-+ [HttpGet]public virtual async Task<IActionResult> PageDetailsPopup(string systemName){var model = await _mediator.Send(new GetPageBlock { SystemName = systemName });diff --git a/src/Web/Grand.Web/Controllers/PixelController.cs b/src/Web/Grand.Web/Controllers/PixelController.csindex 957e4e9e3..e906edf4a 100644--- a/src/Web/Grand.Web/Controllers/PixelController.cs+++ b/src/Web/Grand.Web/Controllers/PixelController.cs@@ -1,5 +1,4 @@using Grand.Business.Core.Interfaces.Messages;-using Grand.Infrastructure;using Grand.Web.Common.Controllers;using Microsoft.AspNetCore.Authorization;using Microsoft.AspNetCore.Http;diff --git a/src/Web/Grand.Web/Controllers/ProductController.cs b/src/Web/Grand.Web/Controllers/ProductController.csindex 34d80e0df..d41c7831b 100644--- a/src/Web/Grand.Web/Controllers/ProductController.cs+++ b/src/Web/Grand.Web/Controllers/ProductController.cs@@ -76,7 +76,7 @@ namespace Grand.Web.Controllers#endregion#region Product details page-+ [HttpGet]public virtual async Task<IActionResult> ProductDetails(string productId){var product = await _productService.GetProductById(productId);@@ -301,7 +301,7 @@ namespace Grand.Web.Controllers}#region Quick view product-+ [HttpGet]public virtual async Task<IActionResult> QuickView(string productId){var product = await _productService.GetProductById(productId);@@ -402,7 +402,7 @@ namespace Grand.Web.Controllers#endregion#region Recently viewed products-+ [HttpGet]public virtual async Task<IActionResult> RecentlyViewedProducts(){if (!_catalogSettings.RecentlyViewedProductsEnabled)@@ -421,7 +421,7 @@ namespace Grand.Web.Controllers#endregion#region Related products-+ [HttpGet]public virtual async Task<IActionResult> RelatedProducts(string productId, int? productThumbPictureSize){var productIds = (await _productService.GetProductById(productId)).RelatedProducts.OrderBy(x => x.DisplayOrder).Select(x => x.ProductId2).ToArray();@@ -444,7 +444,7 @@ namespace Grand.Web.Controllers#region Recently added products-+ [HttpGet]public virtual async Task<IActionResult> NewProducts(){if (!_catalogSettings.NewProductsEnabled)@@ -713,7 +713,7 @@ namespace Grand.Web.Controllers#endregion#region Comparing products-+ [HttpGet]public virtual async Task<IActionResult> SidebarCompareProducts([FromServices] MediaSettings mediaSettings){if (!_catalogSettings.CompareProductsEnabled)@@ -723,7 +723,7 @@ namespace Grand.Web.Controllersreturn Json(model);}-+ [HttpGet]public virtual async Task<IActionResult> CompareProducts([FromServices] MediaSettings mediaSettings){if (!_catalogSettings.CompareProductsEnabled)@@ -736,7 +736,7 @@ namespace Grand.Web.Controllers#endregion#region Calendar-+ [HttpGet]public virtual async Task<IActionResult> GetDatesForMonth(string productId, int month, string parameter, int year, [FromServices] IProductReservationService productReservationService){var allReservations = await productReservationService.GetProductReservationsByProductId(productId, true, null);diff --git a/src/Web/Grand.Web/Controllers/PushNotificationsController.cs b/src/Web/Grand.Web/Controllers/PushNotificationsController.csindex c538dfc07..fa410c44d 100644--- a/src/Web/Grand.Web/Controllers/PushNotificationsController.cs+++ b/src/Web/Grand.Web/Controllers/PushNotificationsController.cs@@ -1,6 +1,7 @@using Grand.Business.Core.Interfaces.Marketing.PushNotifications;using Grand.Domain.PushNotifications;using Grand.Infrastructure;+using Grand.Web.Common.Attributes;using Grand.Web.Common.Controllers;using Microsoft.AspNetCore.Mvc;@@ -17,6 +18,7 @@ namespace Grand.Web.Controllers_pushNotificationsService = pushNotificationsService;}+ [IgnoreApi][HttpPost]public virtual async Task<IActionResult> ProcessRegistration(bool success, string value){diff --git a/src/Web/Grand.Web/Controllers/ShoppingCartController.cs b/src/Web/Grand.Web/Controllers/ShoppingCartController.csindex a634490ce..40553e4b0 100644--- a/src/Web/Grand.Web/Controllers/ShoppingCartController.cs+++ b/src/Web/Grand.Web/Controllers/ShoppingCartController.cs@@ -96,7 +96,7 @@ namespace Grand.Web.Controllers#endregion#region Shopping cart-+ [HttpGet]public async Task<IActionResult> SidebarShoppingCart(){if (!_shoppingCartSettings.MiniShoppingCartEnabled)@@ -260,7 +260,7 @@ namespace Grand.Web.ControllersdownloadGuid = download.DownloadGuid});}-+ [HttpGet]public virtual async Task<IActionResult> Cart(bool checkoutAttributes){if (!await _permissionService.Authorize(StandardPermission.EnableShoppingCart))@@ -278,7 +278,7 @@ namespace Grand.Web.Controllers});return View(model);}-+ [HttpGet][DenySystemAccount]public async Task<IActionResult> CartSummary(){@@ -297,7 +297,7 @@ namespace Grand.Web.Controllersreturn Json(model);}-+ [HttpGet][DenySystemAccount]public async Task<IActionResult> CartTotal(){@@ -356,7 +356,7 @@ namespace Grand.Web.Controllersmodel = cartModel});}-+ [HttpGet][DenySystemAccount]public virtual async Task<IActionResult> ClearCart(){@@ -476,7 +476,7 @@ namespace Grand.Web.Controllerssidebarshoppingcartmodel = miniShoppingCart});}-+ [HttpGet]public virtual IActionResult ContinueShopping(){var returnUrl =@@ -487,7 +487,7 @@ namespace Grand.Web.Controllersreturn RedirectToRoute("HomePage");}-+ [HttpPost][DenySystemAccount]public virtual async Task<IActionResult> StartCheckout(CheckoutAttributeSelectedModel model){diff --git a/src/Web/Grand.Web/Controllers/VendorController.cs b/src/Web/Grand.Web/Controllers/VendorController.csindex f23ea516d..a469d7934 100644--- a/src/Web/Grand.Web/Controllers/VendorController.cs+++ b/src/Web/Grand.Web/Controllers/VendorController.cs@@ -95,7 +95,7 @@ namespace Grand.Web.Controllers#endregion#region Methods-+ [HttpGet]public virtual async Task<IActionResult> ApplyVendor(){if (!_vendorSettings.AllowCustomersToApplyForVendorAccount)@@ -226,7 +226,7 @@ namespace Grand.Web.Controllers});return View(model);}-+ [HttpGet]public virtual async Task<IActionResult> Info(){if (!await _groupService.IsRegistered(_workContext.CurrentCustomer))diff --git a/src/Web/Grand.Web/Controllers/WishlistController.cs b/src/Web/Grand.Web/Controllers/WishlistController.csindex 694ea88d9..ee8b05dae 100644--- a/src/Web/Grand.Web/Controllers/WishlistController.cs+++ b/src/Web/Grand.Web/Controllers/WishlistController.cs@@ -1,5 +1,4 @@using Grand.Business.Core.Interfaces.Checkout.Orders;-using Grand.Business.Core.Interfaces.Common.Directory;using Grand.Business.Core.Interfaces.Common.Localization;using Grand.Business.Core.Interfaces.Common.Security;using Grand.Business.Core.Interfaces.Customers;@@ -28,7 +27,6 @@ namespace Grand.Web.Controllersprivate readonly IShoppingCartService _shoppingCartService;private readonly ITranslationService _translationService;private readonly ICustomerService _customerService;- private readonly IGroupService _groupService;private readonly IPermissionService _permissionService;private readonly IMediator _mediator;private readonly ShoppingCartSettings _shoppingCartSettings;@@ -42,7 +40,6 @@ namespace Grand.Web.ControllersIShoppingCartService shoppingCartService,ITranslationService translationService,ICustomerService customerService,- IGroupService groupService,IPermissionService permissionService,IMediator mediator,ShoppingCartSettings shoppingCartSettings)@@ -51,7 +48,6 @@ namespace Grand.Web.Controllers_shoppingCartService = shoppingCartService;_translationService = translationService;_customerService = customerService;- _groupService = groupService;_permissionService = permissionService;_mediator = mediator;_shoppingCartSettings = shoppingCartSettings;