public ActionResult Article(Guid id) { var model = GetModel(id, CurrentUser.Id, i => _resourcesQuery.GetArticle(i), u => _resourcesQuery.GetRecentlyViewedArticles(u, RecentItemsCount)); if (model == null) { return(NotFound("article", "id", id)); } // Check url. var result = EnsureUrl(model.Resource.GenerateUrl(model.Categories)); return(result ?? View(model)); }
protected override ResourceContent GetContent(Guid id, object cache) { // Look for the resource item. var article = _resourcesQuery.GetArticle(id); if (article != null) { return new ResourceContent { Resource = article, Views = _resourcesQuery.GetViewingCount(id) } } ; var video = _resourcesQuery.GetVideo(id); if (video != null) { return new ResourceContent { Resource = video, Views = _resourcesQuery.GetViewingCount(id) } } ; var qna = _resourcesQuery.GetQnA(id); if (qna != null) { return new ResourceContent { Resource = qna, Views = _resourcesQuery.GetViewingCount(id) } } ; var faq = _faqsQuery.GetFaq(id); if (faq != null) { return new ResourceContent { Resource = faq, Views = 0 } } ; return(null); }
public ActionResult ViewArticle(Guid id) { try { var article = _resourcesQuery.GetArticle(id); if (article == null) { return(JsonNotFound("article")); } var userId = CurrentMember == null ? CurrentAnonymousUser.Id : CurrentMember.Id; _resourcesCommand.ViewArticle(userId, article.Id); } catch (UserException ex) { ModelState.AddModelError(ex, new StandardErrorHandler()); } return(Json(new JsonResponseModel())); }