public async Task <IActionResult> Create([Bind("ItemID,ItemName,ItemPrice,ID")] Item item) { if (ModelState.IsValid) { _context.Add(item); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(item)); }
public async Task <IActionResult> Create([Bind("RestaurantID,RestaurantName,RestaurantBranch,RestaurantOpeningDate,RestaurantAddress")] Restaurant restaurant) { if (ModelState.IsValid) { _context.Add(restaurant); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(restaurant)); }
public async Task <IActionResult> Create([Bind("CustomerID,CustomerName,ContactNumber,WorkerName")] Customer customer) { if (ModelState.IsValid) { _context.Add(customer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["WorkerID"] = new SelectList(_context.Worker, "WorkerID", "WorkerID", customer.WorkerID); return(View(customer)); }
public async Task <IActionResult> Create([Bind("WorkerID,WorkerName,StartDate,ContactNumber,EmailId,RestaurantName")] Worker worker) { if (ModelState.IsValid) { _context.Add(worker); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["RestaurantID"] = new SelectList(_context.Restaurant, "RestaurantID", "RestaurantID", worker.RestaurantID); return(View(worker)); }