Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        //
        // 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;
        }
Exemplo n.º 3
0
        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;
        }