public async Task <IActionResult> PutGericht(int id, Gericht gericht) { if (id != gericht.Id) { return(BadRequest()); } _context.Entry(gericht).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GerichtExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Create([Bind("Name,Preis,KCal,Vegetarisch,Id,Created,Modified")] Gericht gericht) { if (ModelState.IsValid) { _context.Add(gericht); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(gericht)); }