public async Task <ActionResult> Description(string key) { var encKey = PageHelper.EncodeTitle(key); if (encKey != key) { return(RedirectToActionPermanent("Description", new { key = encKey })); } try { ViewBag.User = await _auth.GetCurrentUserAsync(User); var vm = new PageVM <PageDescriptionVM> { Body = await _cache.GetOrAddAsync(key, async() => await _pages.GetPageDescriptionAsync(key)), InfoBlock = await _cache.GetOrAddAsync(key, async() => await _pages.GetPageInfoBlockAsync(key)) }; return(View(vm)); } catch (RedirectRequiredException ex) { return(RedirectToActionPermanent("Description", new { key = ex.Key })); } }
public async Task <ActionResult> Preview(Guid?id) { var page = await _pages.GetPageDraftPreviewAsync(id, User); if (page == null) { return(NotFound()); } var vm = new PageVM <PageDescriptionVM> { Body = await _pagePresenter.GetPageDescriptionAsync(page), InfoBlock = await _pagePresenter.GetPageInfoBlockAsync(page) }; ViewBag.IsPreview = true; return(View("~/Areas/Front/Views/Page/Description.cshtml", vm)); }
public async Task <ActionResult> Description(string key) { return(await DisplayTab(key, () => _pages.GetPageDescriptionAsync(key))); }