public async Task <ActionResult <WineBarrel> > PostWineBarrel(WineBarrel wineBarrel) { _context.WineBarrels.Add(wineBarrel); await _context.SaveChangesAsync(); return(CreatedAtAction("GetWineBarrel", new { id = wineBarrel.Id }, wineBarrel)); }
public async Task <IActionResult> PutWineBarrel(int id, WineBarrel wineBarrel) { if (id != wineBarrel.Id) { return(BadRequest()); } _context.Entry(wineBarrel).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WineBarrelExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }