public async Task <IActionResult> PutScheduleEngineer(string id, ScheduleEngineer scheduleEngineer) { if (id != scheduleEngineer.Id) { return(BadRequest()); } _context.Entry(scheduleEngineer).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ScheduleEngineerExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <ScheduleEngineer> > PostScheduleEngineer(ScheduleEngineer scheduleEngineer) { _context.Engineers.Add(scheduleEngineer); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (ScheduleEngineerExists(scheduleEngineer.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetScheduleEngineer", new { id = scheduleEngineer.Id }, scheduleEngineer)); }