// GET: ProductDetail/Details/ public IActionResult Details(long?id) { if (id == null) { return(NotFound()); } ProductDetail productDetail = service.FindById(id.Value); if (productDetail == null) { return(NotFound()); } return(View(productDetail)); }
public ActionResult LoadAll() { var carts = ShoppingCart.Cart.Items; var cartModel = (ICollection <OrderDetail>)carts; foreach (var item in cartModel) { var test = productDetailService.FindById(item.ProductDetaiID); item.ProductDetail = productDetailService.FindById(item.ProductDetaiID); } ViewBag.Discount = ShoppingCart.Cart.discount; var cartDTO = AutoMapper.Mapper.Map <IEnumerable <OrderDetailDTO> >(cartModel); // return Mutil partialview var quickCart = ViewToString.RenderRazorViewToString(this.ControllerContext, "_QuickCartPartial", cartDTO); var cart = ViewToString.RenderRazorViewToString(this.ControllerContext, "Cart/_Cart", cartDTO); var json = Json(new { quickCart, cart }, JsonRequestBehavior.AllowGet); return(json); }