public async Task <IActionResult> Create([Bind("Id,Name,Price")] Item item) { if (ModelState.IsValid) { _context.Add(item); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(item)); }
public async Task <IActionResult> Create([Bind("Id,Name,EmailId")] Customer customer) { if (ModelState.IsValid) { _context.Add(customer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(customer)); }
public async Task <IActionResult> Create([Bind("Id,TotalAmount,Tip,FinalAmount,CustomerId")] Bill bill) { if (ModelState.IsValid) { _context.Add(bill); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Customers, "Id", "Id", bill.CustomerId); return(View(bill)); }