public async Task <ActionResult <Plaint> > PostPlaint(Plaint plaint) { _context.plaints.Add(plaint); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPlaint", new { id = plaint.Id }, plaint)); }
public async Task <IActionResult> PutPlaint(int id, Plaint plaint) { if (id != plaint.Id) { return(BadRequest()); } _context.Entry(plaint).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlaintExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }