public async Task <ActionResult> CheckoutView() { int?baseId = (Session["Account"] as Account)?.AccountId; var cart = await _order.FindAsync(x => x.AccountId == baseId && x.Status == OrderStatus.InCart); if (cart == null || cart.OrderDetails == null || !cart.OrderDetails.Any()) { return(Redirect("/gio-hang")); } return(View("Checkout", cart)); }
public async Task <PartialViewResult> ShoppingCart() { Order order = new Order(); // Check cart exist int?baseId = (Session["Account"] as Account)?.AccountId; var cart = await _order.FindAsync(x => x.AccountId == baseId && x.Status == OrderStatus.InCart); if (cart != null) { order = cart; } else { order.AccountId = baseId; order.Status = OrderStatus.InCart; await _order.CreateAsync(order); } return(PartialView("_ShoppingCart", order)); }
public async Task <ActionResult> OrderDetail(int orderId) { Order order = await _order.FindAsync(x => x.OrderId == orderId); return(PartialView("~/Areas/Admin/Views/OrderAdmin/OrderDetail.cshtml", order)); }