Skip to content

Commit

Permalink
BasePublicController.cs move to the project Grand.Web.Common
Browse files Browse the repository at this point in the history
  • Loading branch information
support committed Feb 6, 2023
1 parent 3278543 commit 9f73f5c
Show file tree
Hide file tree
Showing 22 changed files with 28 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using Grand.Web.Common.Controllers;
using Grand.Web.Common.Filters;
using Grand.Web.Common.Filters;
using Microsoft.AspNetCore.Mvc;

namespace Grand.Web.Controllers
namespace Grand.Web.Common.Controllers
{
[PublicStore]
[ClosedStore]
Expand All @@ -19,8 +18,8 @@ protected IActionResult InvokeHttp404()
private bool IsJsonResponseView()
{
if (Request.Method.Equals("GET", StringComparison.InvariantCultureIgnoreCase))
return Request.Headers.Accept.ToString()
.Equals("application/json", StringComparison.InvariantCultureIgnoreCase);
return Request.Headers.Accept.ToString().Contains("application/json", StringComparison.InvariantCultureIgnoreCase) ||
Request.Headers.Accept.ToString().Equals("*/*", StringComparison.InvariantCultureIgnoreCase);

if (Request.Method.Equals("POST", StringComparison.InvariantCultureIgnoreCase))
return Request.ContentType?.Contains("application/json") ?? false;
Expand All @@ -31,7 +30,7 @@ private bool IsJsonResponseView()
public new IActionResult View(object model)
{
if (IsJsonResponseView())
return Json(model);
return Ok(model);

return base.View(model);
}
Expand Down
1 change: 1 addition & 0 deletions src/Web/Grand.Web/Controllers/AccountController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Grand.Infrastructure;
using Grand.Infrastructure.Extensions;
using Grand.Web.Commands.Models.Customers;
using Grand.Web.Common.Controllers;
using Grand.Web.Common.Filters;
using Grand.Web.Common.Security.Captcha;
using Grand.Web.Extensions;
Expand Down
1 change: 1 addition & 0 deletions src/Web/Grand.Web/Controllers/ActionCartController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Grand.Domain.Common;
using Grand.Domain.Orders;
using Grand.Infrastructure;
using Grand.Web.Common.Controllers;
using Grand.Web.Common.Filters;
using Grand.Web.Extensions;
using Grand.Web.Features.Models.Products;
Expand Down
1 change: 1 addition & 0 deletions src/Web/Grand.Web/Controllers/BlogController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Grand.Domain.Blogs;
using Grand.Infrastructure;
using Grand.Web.Commands.Models.Blogs;
using Grand.Web.Common.Controllers;
using Grand.Web.Common.Filters;
using Grand.Web.Common.Security.Captcha;
using Grand.Web.Events;
Expand Down
1 change: 1 addition & 0 deletions src/Web/Grand.Web/Controllers/CatalogController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using Grand.Domain.Vendors;
using Grand.Infrastructure;
using Grand.Web.Commands.Models.Vendors;
using Grand.Web.Common.Controllers;
using Grand.Web.Common.Filters;
using Grand.Web.Features.Models.Catalog;
using Grand.Web.Features.Models.Vendors;
Expand Down
1 change: 1 addition & 0 deletions src/Web/Grand.Web/Controllers/CheckoutController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using Grand.Domain.Shipping;
using Grand.Infrastructure;
using Grand.Infrastructure.Extensions;
using Grand.Web.Common.Controllers;
using Grand.Web.Common.Filters;
using Grand.Web.Extensions;
using Grand.Web.Features.Models.Checkout;
Expand Down
3 changes: 2 additions & 1 deletion src/Web/Grand.Web/Controllers/ContactController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
using Grand.Domain.Stores;
using Grand.Infrastructure;
using Grand.Web.Commands.Models.Contact;
using Grand.Web.Common.Controllers;
using Grand.Web.Common.Extensions;
using Grand.Web.Common.Filters;
using Grand.Web.Controllers;
using Grand.Web.Events;
using Grand.Web.Models.Contact;
using MediatR;
Expand Down Expand Up @@ -41,6 +41,7 @@ public ContactController(

//available even when a store is closed
[ClosedStore(true)]
[HttpGet]
public virtual async Task<IActionResult> ContactUs(
[FromServices] StoreInformationSettings storeInformationSettings,
[FromServices] IPageService pageService)
Expand Down
1 change: 1 addition & 0 deletions src/Web/Grand.Web/Controllers/CountryController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Web.Common.Controllers;
using Grand.Web.Common.Filters;
using Grand.Web.Features.Models.Common;
using Grand.Web.Models.Common;
Expand Down
1 change: 1 addition & 0 deletions src/Web/Grand.Web/Controllers/CourseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Grand.Domain.Customers;
using Grand.Infrastructure;
using Grand.Web.Commands.Models.Courses;
using Grand.Web.Common.Controllers;
using Grand.Web.Features.Models.Courses;
using MediatR;
using Microsoft.AspNetCore.Mvc;
Expand Down
1 change: 1 addition & 0 deletions src/Web/Grand.Web/Controllers/DownloadController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Grand.Domain.Customers;
using Grand.Domain.Orders;
using Grand.Infrastructure;
using Grand.Web.Common.Controllers;
using Grand.Web.Common.Filters;
using Microsoft.AspNetCore.Mvc;
using System.IO.Compression;
Expand Down
3 changes: 2 additions & 1 deletion src/Web/Grand.Web/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using Grand.Web.Common.Controllers;
using Microsoft.AspNetCore.Mvc;

namespace Grand.Web.Controllers
{
Expand Down
1 change: 1 addition & 0 deletions src/Web/Grand.Web/Controllers/KnowledgebaseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Grand.Domain.Localization;
using Grand.Infrastructure;
using Grand.Infrastructure.Caching;
using Grand.Web.Common.Controllers;
using Grand.Web.Common.Filters;
using Grand.Web.Common.Security.Captcha;
using Grand.Web.Events.Cache;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Grand.Domain.Orders;
using Grand.Infrastructure;
using Grand.Web.Commands.Models.Orders;
using Grand.Web.Common.Controllers;
using Grand.Web.Common.Filters;
using Grand.Web.Extensions;
using Grand.Web.Features.Models.Common;
Expand Down
1 change: 1 addition & 0 deletions src/Web/Grand.Web/Controllers/NewsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Grand.Domain.News;
using Grand.Infrastructure;
using Grand.Web.Commands.Models.News;
using Grand.Web.Common.Controllers;
using Grand.Web.Common.Filters;
using Grand.Web.Events;
using Grand.Web.Features.Models.News;
Expand Down
1 change: 1 addition & 0 deletions src/Web/Grand.Web/Controllers/OrderController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Grand.Domain.Shipping;
using Grand.Infrastructure;
using Grand.Web.Commands.Models.Orders;
using Grand.Web.Common.Controllers;
using Grand.Web.Common.Filters;
using Grand.Web.Common.Page;
using Grand.Web.Events;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Grand.Domain.Customers;
using Grand.Domain.Orders;
using Grand.Infrastructure;
using Grand.Web.Common.Controllers;
using Grand.Web.Common.Filters;
using Grand.Web.Features.Models.ShoppingCart;
using Grand.Web.Models.Catalog;
Expand Down
1 change: 1 addition & 0 deletions src/Web/Grand.Web/Controllers/PageController.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Grand.Business.Core.Interfaces.Common.Localization;
using Grand.Business.Core.Interfaces.Common.Security;
using Grand.Business.Core.Utilities.Common.Security;
using Grand.Web.Common.Controllers;
using Grand.Web.Common.Filters;
using Grand.Web.Features.Models.Pages;
using Grand.Web.Models.Pages;
Expand Down
1 change: 1 addition & 0 deletions src/Web/Grand.Web/Controllers/ProductController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Grand.Domain.Media;
using Grand.Infrastructure;
using Grand.Web.Commands.Models.Products;
using Grand.Web.Common.Controllers;
using Grand.Web.Common.Extensions;
using Grand.Web.Common.Filters;
using Grand.Web.Common.Security.Captcha;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Grand.Business.Core.Interfaces.Marketing.PushNotifications;
using Grand.Domain.PushNotifications;
using Grand.Infrastructure;
using Grand.Web.Common.Controllers;
using Microsoft.AspNetCore.Mvc;

namespace Grand.Web.Controllers
Expand Down
1 change: 1 addition & 0 deletions src/Web/Grand.Web/Controllers/ShoppingCartController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Grand.Domain.Orders;
using Grand.Infrastructure;
using Grand.Web.Commands.Models.ShoppingCart;
using Grand.Web.Common.Controllers;
using Grand.Web.Common.Extensions;
using Grand.Web.Common.Filters;
using Grand.Web.Features.Models.ShoppingCart;
Expand Down
1 change: 1 addition & 0 deletions src/Web/Grand.Web/Controllers/VendorController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Grand.Infrastructure;
using Grand.SharedKernel.Extensions;
using Grand.Web.Commands.Models.Vendors;
using Grand.Web.Common.Controllers;
using Grand.Web.Common.Extensions;
using Grand.Web.Common.Filters;
using Grand.Web.Common.Security.Captcha;
Expand Down
1 change: 1 addition & 0 deletions src/Web/Grand.Web/Controllers/WishlistController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Grand.Domain.Orders;
using Grand.Infrastructure;
using Grand.SharedKernel.Extensions;
using Grand.Web.Common.Controllers;
using Grand.Web.Common.Filters;
using Grand.Web.Common.Security.Captcha;
using Grand.Web.Features.Models.ShoppingCart;
Expand Down

0 comments on commit 9f73f5c

Please sign in to comment.