public OrderController(ISAD251_OHamiltonContext context) { _context = context; ProductList = (from p in _context.Products.AsEnumerable() //get a list of all the products select new SelectListItem { Text = p.Name, Value = p.Id.ToString() }).ToList(); }
public ViewOrderController(ISAD251_OHamiltonContext context) { _context = context; OrderList = new List <SelectListItem> { }; foreach (Orders i in _context.Orders) //get all the orders that match the current table number { if (i.TableNumber.Value == tableNumber) { OrderList.Add(new SelectListItem //put them in a format where the html can use it { Text = i.Name + "'s order costing £" + i.TotalPrice, Value = i.Id.ToString() }); } } }
public AdminController(ISAD251_OHamiltonContext context) { _context = context; }