//[OutputCache(CacheProfile = "cacheProfile")] public async Task <ActionResult> MainNews(int?newsItemId, string title) { if (newsItemId == null) { throw new HttpException(404, "Not Found"); } var newsItem = applicationCache_MainNews.GetValue((int)newsItemId); if (newsItem == null) { newsItem = await StorageManager.GetStorage().Get(newsItemId.Value); applicationCache_MainNews.Add(newsItem); } if (newsItem == null) { throw new HttpException(404, "Error 404, bad page"); } string canonicalUrl = NewsManager.EditNewsTitleForUrl(newsItem.Title); bool isCanonical = title.ToLower() == canonicalUrl.ToLower(); var userRepository = UnityConfig.Resolve <IUserRepository>(); var newsUser = await userRepository.GetById(newsItem.UserId); var commentRepository = UnityConfig.Resolve <ICommentRepository>(); var commentItems = await commentRepository.GetCommentsOnNewsPage(newsItemId.Value); var showMainNews = new NewsItemMainPageViewModel() { Id = newsItem.Id, Title = newsItem.Title, Content = newsItem.Content, SourceImage = newsItem.SourceImage, CreationDate = newsItem.CreationDate, UserId = newsItem.UserId, UserName = newsUser.UserName, CommentItems = commentItems, IsCanonical = isCanonical, CanonicalUrl = canonicalUrl }; return(View(showMainNews)); }