public ActionResult Index(int productId) { ViewBag.ProductName = _repo.GetProductName(productId); ViewBag.ProductId = productId; var comments = _repo.GetProductComments(productId); var commentsVm = new List <ProductCommentWithPersianDateViewModel>(); foreach (var comment in comments) { var commentVm = new ProductCommentWithPersianDateViewModel(comment); commentsVm.Add(commentVm); } return(View(commentsVm)); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProductComment comment = _repo.Get(id.Value); if (comment == null) { return(HttpNotFound()); } var commentVm = new ProductCommentWithPersianDateViewModel(comment); return(PartialView(commentVm)); }