public async Task <IActionResult> PutCatInsumo([FromRoute] short id, [FromBody] CatInsumo catInsumo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != catInsumo.idCatinsumo) { return(BadRequest()); } _context.Entry(catInsumo).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CatInsumoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostCatInsumo([FromBody] CatInsumo catInsumo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.CatInsumo.Add(catInsumo); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCatInsumo", new { id = catInsumo.idCatinsumo }, catInsumo)); }