public async Task <ActionResult <TbEstoque> > PostTbEstoque([FromForm] TbEstoque tbEstoque) { _context.TbEstoques.Add(tbEstoque); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTbEstoque", new { id = tbEstoque.Id }, tbEstoque)); }
public async Task <IActionResult> PutTbEstoque(int id, [FromForm] TbEstoque tbEstoque) { if (id != tbEstoque.Id) { return(BadRequest()); } _context.Entry(tbEstoque).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TbEstoqueExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }