public IActionResult Order() { var curomer = _db.Customer.Find(_binaryHelper.FromBinary <Customer>(HttpContext.Session.Get("Customer")).CustomerId); _db.Entry(curomer).Collection(c => c.Order).Load(); var order = curomer.Order.Where(o => o.IsPayed == false).ToList(); return(View(order)); }
public IActionResult Index(int id) { ViewData["ProductAttributes"] = _context.ProductAttribute.OrderBy(p => p.Name).ToList(); var product = _context.Product.Include(p => p.ProductAttributeValue).Where(p => p.ProductId == id).First(); foreach (var productAttribute in product.ProductAttributeValue.Select(p => p.ProductAttribute)) { _context.Entry(productAttribute).Reference(p => p.Unit).Load(); } return(View(product)); }
public IActionResult Index(int id) { if (id != 0) { HttpContext.Session.SetInt32("Id", id); } else if (HttpContext.Session.Keys.Contains("Id")) { id = (int)HttpContext.Session.GetInt32("Id"); } var orderDetails = _context.Order.Include(o => o.OrderDetail).Where(o => o.OrderId == id).First().OrderDetail.ToList(); foreach (var orderDetail in orderDetails) { _context.Entry(orderDetail).Reference(o => o.Product).Load(); } return(View(orderDetails)); }