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