public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Ingredients,Price")] ListaPizza listaPizza) { if (id != listaPizza.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(listaPizza); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ListaPizzaExists(listaPizza.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(listaPizza)); }
public async Task <IActionResult> Create([Bind("ID,Name,Ingredients,Price")] ListaPizza listaPizza) { if (ModelState.IsValid) { _context.Add(listaPizza); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(listaPizza)); }