public async Task <ActionResult <TypeOfWhiskey> > PostTypeOfWhiskey(TypeOfWhiskey typeOfWhiskey) { _context.TypesOfWhiskey.Add(typeOfWhiskey); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetTypeOfWhiskey), new { id = typeOfWhiskey.ID }, typeOfWhiskey)); }
public async Task <IActionResult> PutTypeOfWhiskey(int id, TypeOfWhiskey typeOfWhiskey) { if (id != typeOfWhiskey.ID) { return(BadRequest()); } _context.Entry(typeOfWhiskey).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TypeOfWhiskeyExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }