public async Task <IActionResult> Create([Bind("ID,Food_Name,Food_Type,Food_Quantity,Price")] Food food) { if (ModelState.IsValid) { _context.Add(food); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(food)); }
public async Task <IActionResult> Create([Bind("ID,First_Name,Last_Name,Address,Gender,DOB")] Staff staff) { if (ModelState.IsValid) { _context.Add(staff); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(staff)); }
public async Task <IActionResult> Create([Bind("ID,CustomerID,StaffID,FoodID")] Order order) { if (ModelState.IsValid) { _context.Add(order); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CustomerID"] = new SelectList(_context.Customer, "ID", "ID", order.CustomerID); ViewData["FoodID"] = new SelectList(_context.Food, "ID", "ID", order.FoodID); ViewData["StaffID"] = new SelectList(_context.Set <Staff>(), "ID", "ID", order.StaffID); return(View(order)); }