public async Task <IEnumerable <Route> > GetRedirectRoutesAsync(string siteId) { var routes = new List <Route>(); var seo = await GetSeoCommand.LoadSeoBusinessModelAsync(_dataFactory, siteId); if (seo != null && seo.Redirects != null) { foreach (var seoRedirect in seo.Redirects) { routes.Add( new Route { Identity = "1", Action = "Index", Controller = "Redirect", Path = seoRedirect.PathSource, Regex = "^" + seoRedirect.PathSource + "$", RedirectPath = seoRedirect.PathDestination }); } } return(routes); }
// // GET: /Home/ public HomeController(BusinessFactory business, IRouteManager routeManager, ModuleManager moduleManager, GetSeoCommand getSeoCommand, SeoService seoService, ResetSiteCacheCommand resetSiteCacheCommand, IOptions <ApplicationConfig> options, ILogger <HomeController> logger) : base(business) { _routeManager = routeManager; _moduleManager = moduleManager; _seoService = seoService; _resetSiteCacheCommand = resetSiteCacheCommand; _logger = logger; _applicationConfig = options.Value; _getSeoCommand = getSeoCommand; }
public async Task<CommandResult> Get([FromServices]GetSeoCommand _getSeoCommand, string siteId) { var userInput = new UserInput<GetSeoInput> { UserId = User.GetUserId(), Data = new GetSeoInput {SiteId = siteId, IsVerifyAuthorisation = true} }; var result = await Business.InvokeAsync<GetSeoCommand, UserInput<GetSeoInput>, CommandResult<SeoBusinessModel>>( _getSeoCommand, userInput); return result; }