예제 #1
0
        public async Task <IActionResult> PutRace(int id, Race race)
        {
            if (id != race.Id)
            {
                return(BadRequest());
            }

            _context.Entry(race).State = EntityState.Modified;                      // Entiry Methdod!  (Race Only Update)
            //_context.Races.Update(race);                                            // Update everything for now.
            //_context.Entry(race.Standings).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!RaceExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #2
0
        public async Task <IActionResult> PutStanding(int id, Standing standing)
        {
            if (id != standing.RaceId)
            {
                return(BadRequest());
            }

            _context.Entry(standing).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StandingExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }