public async Task <IActionResult> PutProd(string id, Prod Prod) { if (id != Prod.CG_PROD) { return(BadRequest()); } _context.Entry(Prod).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProdExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Prod> > PostProd(Prod Prod) { _context.Prod.Add(Prod); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (ProdExists(Prod.CG_PROD)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetProd", new { id = Prod.CG_PROD }, Prod)); }