public async Task <IActionResult> PutProduto(Guid id, Produto produto) { if (id != produto.Id) { return(BadRequest()); } _context.Entry(produto).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProdutoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutCategoria(Guid id, Categoria categoria) { if (id != categoria.Id) { return(BadRequest()); } _context.Entry(categoria).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoriaExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }