public async Task <IActionResult> StaticRouter(string url) { var articleInfo = await _articleInfoAppService.GetArticleInfoByStaticUrl(url); if (articleInfo != null) { return(RedirectToAction("Detail", "Article", new { articleInfo.ArticleInfo.Id })); } return(NotFound()); }
public async Task <IActionResult> Detail(string url) { GetArticleInfoForEditOutput articleInfo; var articleInfoCache = await _cacheManager.GetCache <string, GetArticleInfoForEditOutput>("ArticleInfo").GetOrDefaultAsync(url); if (articleInfoCache == null) { articleInfo = await _articleInfoAppService.GetArticleInfoByStaticUrl(url); if (articleInfo == null) { return(NotFound()); } await _cacheManager.GetCache <string, GetArticleInfoForEditOutput>("ArticleInfo") .SetAsync(url, articleInfo); } else { articleInfo = articleInfoCache; } return(View(articleInfo)); }