Example #1
0
 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();
 }
Example #2
0
 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()
             });
         }
     }
 }
Example #3
0
 public AdminController(ISAD251_OHamiltonContext context)
 {
     _context = context;
 }