public async Task <IActionResult> PutScreference([FromRoute] int id, [FromBody] Screference screference) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != screference.Id) { return(BadRequest()); } _context.Entry(screference).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ScreferenceExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostScreference([FromBody] Screference screference) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Screference.Add(screference); await _context.SaveChangesAsync(); return(CreatedAtAction("GetScreference", new { id = screference.Id }, screference)); }