예제 #1
0
        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());
        }
예제 #2
0
        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));
        }