public override object PrepareViewModel() { var postList = _nccPostService.LoadRecentPages(PostCount); RecentPostViewModel model = new RecentPostViewModel(); model.IsDateShow = IsDateShow; model.PostList = postList; return(model); }
public override string RenderBody() { var postList = _nccPostService.LoadRecentPages(PostCount); RecentPostViewModel item = new RecentPostViewModel(); item.IsDateShow = IsDateShow; item.PostList = postList; var body = _viewRenderService.RenderToStringAsync <BlogController>(ViewFileName, item).Result; return(body); }
/// <summary> /// 设置展示的最近文章 到ViewBag.RecentPost /// </summary> private RecentPostViewModel GetRecentPostAction() { RecentPostViewModel viewModel = null; if (!this._memoryCache.TryGetValue(MemoryCacheKeys.RecentPost, out viewModel)) { viewModel = this._viewProjectionFactory.GetViewProjection <RecentPostBindModel, RecentPostViewModel>(new RecentPostBindModel()); this._memoryCache.Set(MemoryCacheKeys.RecentPost, viewModel); } return(viewModel); }