public async Task <IActionResult> PutGame(Guid id, Game game) { if (id != game.GameId) { return(BadRequest()); } _context.Entry(game).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GameExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Create([Bind("ID,Name")] CheeseCategory cheeseCategory) { if (ModelState.IsValid) { _context.Add(cheeseCategory); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(cheeseCategory)); }