public void OnActionExecuted(ActionExecutedContext filterContext)
        {
            EcardModel model = filterContext.Controller.ViewData.Model as EcardModel;

            if (model != null && model.Container == null)
            {
                var controller = filterContext.RouteData.Values["controller"].ToString();
                var action     = filterContext.RouteData.Values["action"].ToString();

                var controllerType = _controllerFinder.FindController(controller);
                if (controllerType == null)
                {
                    return;
                }

                var controllerTypeDesc = ViewModelDescriptor.GetTypeDescriptor(controllerType);

                PageContainer c = new PageContainer();
                c.Description = controllerTypeDesc.Description;
                c.DisplayName = controllerTypeDesc.LongName;
                c.Name        = controllerTypeDesc.Name;

                model.Container = c;
            }
        }
        public void OnActionExecuted(ActionExecutedContext filterContext)
        {
            EcardModel model = filterContext.Controller.ViewData.Model as EcardModel;

            if (model != null)
            {
                model.AntiForgeryToken = new AntiForgeryToken(site.SiteId.ToString());
            }
        }
Example #3
0
        public void OnActionExecuted(ActionExecutedContext filterContext)
        {
            EcardModel model = filterContext.Controller.ViewData.Model as EcardModel;

            if (model != null)
            {
                model.Site = new SiteViewModel(site, _unityContainer);
            }
        }
Example #4
0
        public void OnActionExecuted(ActionExecutedContext filterContext)
        {
            EcardModel model = filterContext.Controller.ViewData.Model as EcardModel;

            if (model != null)
            {
                _unityContainer.BuildUp(model.GetType(), model);
            }
        }
Example #5
0
        public static string CssPath(this UrlHelper urlHelper, string relativePath, EcardModel model)
        {
            if (!string.IsNullOrEmpty(relativePath) && !relativePath.StartsWith("/"))
            {
                relativePath = "/" + relativePath;
            }

            return(string.Format(urlHelper.AppPath(model.Site.CssPath), model.SkinName) + relativePath);
        }
Example #6
0
        public static void RenderFavIcon <TModel>(this HtmlHelper <TModel> htmlHelper) where TModel : EcardModel
        {
            EcardModel model = htmlHelper.ViewData.Model;

            if (!string.IsNullOrEmpty(model.Site.FavIconUrl))
            {
                var urlHelper = new UrlHelper(htmlHelper.ViewContext.RequestContext);

                htmlHelper.ViewContext.HttpContext.Response.Write(htmlHelper.HeadLink("shortcut icon", urlHelper.AppPath(model.Site.FavIconUrl), null, null));
            }
        }
Example #7
0
        public static void RenderOpenSearch <TModel>(this HtmlHelper <TModel> htmlHelper) where TModel : EcardModel
        {
            EcardModel model = htmlHelper.ViewData.Model;

            if (model.Site.IncludeOpenSearch)
            {
                var urlHelper = new UrlHelper(htmlHelper.ViewContext.RequestContext);

                htmlHelper.ViewContext.HttpContext.Response.Write(htmlHelper.HeadLink("search", urlHelper.AbsolutePath(urlHelper.OpenSearch()),
                                                                                      "application/opensearchdescription+xml",
                                                                                      string.Format(model.Localize("SearchFormat", "{0} Search"), model.Site.DisplayName)));
            }
        }
Example #8
0
        public void OnActionExecuted(ActionExecutedContext filterContext)
        {
            EcardModel model = filterContext.Controller.ViewData.Model as EcardModel;

            if (model != null)
            {
                var user = _securityHelper.GetCurrentUser();
                if (user != null)
                {
                    model.Menus = _menuService.GetMenus(user.CurrentUser);
                }
            }
        }
Example #9
0
        public void OnActionExecuted(ActionExecutedContext filterContext)
        {
            EcardModel model = filterContext.Controller.ViewData.Model as EcardModel;

            if (model != null)
            {
                var user = filterContext.HttpContext.User.Identity.IsAuthenticated
                    ? _securityHelper.GetCurrentUser()
                    : null;

                if (user != null)
                {
                    model.User      = user.CurrentUser;
                    model.UserModel = user;
                }
            }
        }
Example #10
0
 public static string ScriptPath(this UrlHelper urlHelper, EcardModel model)
 {
     return(ScriptPath(urlHelper, "", model));
 }
Example #11
0
 public static string CssPath(this UrlHelper urlHelper, EcardModel model)
 {
     return(CssPath(urlHelper, "", model));
 }