Beispiel #1
0
        public async Task <IActionResult> PutCity(int id, City city)
        {
            if (id != city.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
 public async Task Update(City city)
 {
     _context.Entry(city).State = EntityState.Modified;
     await _context.SaveChangesAsync();
 }