public async Task <IActionResult> PutEstorage(short id, Estorage estorage) { if (id != estorage.EstorageId) { return(BadRequest()); } _context.Entry(estorage).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EstorageExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Estorage> > PostEstorage(Estorage estorage) { _context.Estorage.Add(estorage); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (EstorageExists(estorage.EstorageId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetEstorage", new { id = estorage.EstorageId }, estorage)); }