public async Task <IActionResult> PutEarrivalDepartureTimes(short id, EarrivalDepartureTimes earrivalDepartureTimes) { if (id != earrivalDepartureTimes.EarrivalDepartureTimesId) { return(BadRequest()); } _context.Entry(earrivalDepartureTimes).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EarrivalDepartureTimesExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <EarrivalDepartureTimes> > PostEarrivalDepartureTimes(EarrivalDepartureTimes earrivalDepartureTimes) { _context.EarrivalDepartureTimes.Add(earrivalDepartureTimes); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (EarrivalDepartureTimesExists(earrivalDepartureTimes.EarrivalDepartureTimesId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetEarrivalDepartureTimes", new { id = earrivalDepartureTimes.EarrivalDepartureTimesId }, earrivalDepartureTimes)); }