public async Task <IActionResult> PutCustoOrcamento([FromRoute] Guid id, [FromBody] CustoOrcamento custoOrcamento) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != custoOrcamento.custoOrcamentoId) { return(BadRequest()); } _context.Entry(custoOrcamento).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustoOrcamentoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostCustoOrcamento([FromBody] CustoOrcamento custoOrcamento) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.CustoOrcamentos.Add(custoOrcamento); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCustoOrcamento", new { id = custoOrcamento.custoOrcamentoId }, custoOrcamento)); }