public ActionResult Index(int articleId) { ViewBag.ArticleName = _repo.GetArticleName(articleId); ViewBag.ArticleId = articleId; var comments = _repo.GetArticleComments(articleId); var commentsVm = new List <CommentWithPersianDateViewModel>(); foreach (var comment in comments) { var commentVm = new CommentWithPersianDateViewModel(comment); commentsVm.Add(commentVm); } return(View(commentsVm)); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ArticleComment comment = _repo.Get(id.Value); if (comment == null) { return(HttpNotFound()); } var commentVm = new CommentWithPersianDateViewModel(comment); return(PartialView(commentVm)); }