public async Task <IActionResult> Edit(int id, [Bind("city_id,country_id,region_id,name")] City city) { if (id != city.city_id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(city); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CityExists(city.city_id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(city)); }
public async Task Update(City city) { _context.Update(city); await _context.SaveChangesAsync(); }