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
using Grand.Business.Core.Interfaces.Cms;
using Grand.Web.Features.Models.Pages;
using Grand.Mediator;
namespace Grand.Web.Features.Handlers.Pages;
public class GetPageLayoutViewPathHandler : IRequestHandler<GetPageLayoutViewPath, string>
{
private readonly IPageLayoutService _pageLayoutService;
public GetPageLayoutViewPathHandler(
IPageLayoutService pageLayoutService)
{
_pageLayoutService = pageLayoutService;
}
public async Task<string> Handle(GetPageLayoutViewPath request, CancellationToken cancellationToken)
{
var layout = await _pageLayoutService.GetPageLayoutById(request.LayoutId) ??
(await _pageLayoutService.GetAllPageLayouts()).FirstOrDefault();
if (layout == null)
throw new Exception("No default layout could be loaded");
return layout.ViewPath;
}
}