public async Task <IActionResult> PutServiceevent([FromRoute] int id, [FromBody] Serviceevent serviceevent) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != serviceevent.EventId) { return(BadRequest()); } _context.Entry(serviceevent).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ServiceeventExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostServiceevent([FromBody] Serviceevent serviceevent) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Serviceevent.Add(serviceevent); await _context.SaveChangesAsync(); return(CreatedAtAction("GetServiceevent", new { id = serviceevent.EventId }, serviceevent)); }