public async Task <ActionResult <CpoRequest> > PostCpoRequest(CpoRequest cpoRequest) { _context.CpoRequest.Add(cpoRequest); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCpoRequest", new { id = cpoRequest.Idrequest }, cpoRequest)); }
public async Task <IActionResult> PutCpoRequest(long id, CpoRequest cpoRequest) { if (id != cpoRequest.Idrequest) { return(BadRequest()); } _context.Entry(cpoRequest).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CpoRequestExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }