public async Task <ActionResult> Detail(CommentVM comment, string nameAlias) { var response = new ClientProductDetailResponse(); response.Product = await _clientProductService.GetProductByNameAlias(nameAlias); var relateList = await _clientProductService.GetProductsByCategoryId(response.Product.CategoryId); //Orderby Rating response.RelateProducts = relateList.Take(10); if (ModelState.IsValid) { if (await _clientCommentService.AddCommentToDB(comment) > 0) { response.Comments = await _clientCommentService.GetProductListComment(response.Product.ProductId); return(View(response)); } } response.Comments = await _clientCommentService.GetProductListComment(response.Product.ProductId); ModelState.AddModelError("Review", "Bạn chưa bình luận"); return(View(response)); }
//[OutputCache(Duration = 3600 * 24 * 10, Location = System.Web.UI.OutputCacheLocation.Any, VaryByParam = "nameID")] public async Task <ActionResult> Detail(string nameID) { var response = new ClientProductDetailResponse(); response.Product = await _clientProductService.GetProductByNameAlias(nameID); var relateList = await _clientProductService.GetProductsByCategoryId(response.Product.CategoryId); response.RelateProducts = relateList.Take(10); response.Comments = await _clientCommentService.GetProductListComment(response.Product.ProductId); return(View(response)); }