/// <summary>在调用操作方法后调用。</summary> /// <param name="filterContext">有关当前请求和操作的信息。</param> public override void OnActionExecuted(ActionExecutedContext filterContext) { base.OnActionExecuted(filterContext); if (filterContext.HttpContext.Request.Method.Equals("POST", StringComparison.InvariantCultureIgnoreCase)) { if (filterContext.Result is ViewResult) { filterContext.Result = ResultData(null, false, "该URL仅支持Get请求方式", false, HttpStatusCode.MethodNotAllowed); } return; } #region 准备页面数据模型 ViewBag.menus = MenuService.GetQueryFromCache <MenuDto>(m => m.Status == Status.Available).OrderBy(m => m.Sort).ToList(); //菜单 var model = new PageFootViewModel //页脚 { Links = LinksService.GetQueryFromCache <LinksDto>(l => l.Status == Status.Available).OrderByDescending(l => l.Recommend).ThenByDescending(l => l.Weight).ThenByDescending(l => new Random().Next()).Take(40).ToList() }; ViewBag.Footer = model; #endregion ViewData["ActionElapsed"] = Stopwatch.ElapsedMilliseconds + "ms"; if (Stopwatch.ElapsedMilliseconds > 5000) { LogManager.Debug($"请求路径:{Request.Scheme}://{Request.Host}{HttpUtility.UrlDecode(Request.Path)}执行耗时{Stopwatch.ElapsedMilliseconds}ms"); } }
/// <summary>在调用操作方法后调用。</summary> /// <param name="filterContext">有关当前请求和操作的信息。</param> public override void OnActionExecuted(ActionExecutedContext filterContext) { if (filterContext.Result is ViewResult) { ViewBag.menus = MenuService.GetQueryFromCache(m => m.ParentId == null && m.Status == Status.Available).OrderBy(m => m.Sort).ToList(); //菜单 var model = new PageFootViewModel //页脚 { Links = LinksService.GetQueryFromCache <LinksDto>(l => l.Status == Status.Available).OrderByDescending(l => l.Recommend).ThenByDescending(l => l.Weight).Take(30).ToList() }; ViewBag.Footer = model; } }
/// <summary>在调用操作方法后调用。</summary> /// <param name="filterContext">有关当前请求和操作的信息。</param> public override void OnActionExecuted(ActionExecutedContext filterContext) { base.OnActionExecuted(filterContext); if (filterContext.HttpContext.Request.Method.Equals("POST", StringComparison.InvariantCultureIgnoreCase)) { if (filterContext.Result is ViewResult) { filterContext.Result = ResultData(null, false, "该URL仅支持Get请求方式", false, HttpStatusCode.MethodNotAllowed); } return; } ViewBag.menus = MenuService.GetQueryFromCache <MenuDto>(m => m.Status == Status.Available).OrderBy(m => m.Sort).ToList(); //菜单 var model = new PageFootViewModel //页脚 { Links = LinksService.GetQueryFromCache <LinksDto>(l => l.Status == Status.Available).OrderByDescending(l => l.Recommend).ThenByDescending(l => l.Weight).ThenByDescending(l => new Random().Next()).Take(30).ToList() }; ViewBag.Footer = model; }
public ActionResult Index() { var list = LinksService.GetQueryFromCache <bool, LinksOutputDto>(l => l.Status == Status.Available, l => l.Recommend, false).ToList(); return(CurrentUser.IsAdmin ? View("Index_Admin", list) : View(list)); }