public ActionResult ArticleDetails(Guid?id) { IArticleBLL articleBLL = new ArticleBLL(); if (id == null || !articleBLL.ExistArticle(id.Value)) { return(RedirectToAction(nameof(ArticleList))); } ViewBag.Comments = articleBLL.GetCommentsByArticleId(id.Value); return(View(articleBLL.GetOneArticleById(id.Value))); }
public ActionResult EditArticle(Guid id) { IArticleBLL articleBLL = new ArticleBLL(); var article = articleBLL.GetOneArticleById(id); EditArticleViewModel editArticleViewModel = new EditArticleViewModel { Title = article.Title, Content = article.Content, CategoryIds = article.CategoryIds, ArticleId = article.Id }; // all user's categories var userId = Guid.Parse(Session["loginUserId"].ToString()); ViewBag.CategoryIds = new ArticleBLL().GetAllCategories(userId); return(View(editArticleViewModel)); }