public async Task <ActionResult <ReservaItem> > PostReservaItem(ReservaItem item) { _context.ReservaItems.Add(item); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetReservaItem), new { id = item.Id }, item)); }
public async Task <ActionResult <ReservaItem> > PostReservaItem(ReservaItem item) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.ReservaItems.Add(item); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetReservaItem), new { id = item.Id }, item)); }
public async Task <IActionResult> PutReservaItem(int id, ReservaItem item) { if (id != item.Id) { return(BadRequest()); } _context.Entry(item).State = EntityState.Modified; await _context.SaveChangesAsync(); return(NoContent()); }