public async Task <IActionResult> Edit(int id, [Bind("SettlementId,Iddistrict,Name,Type,Population")] Settlements settlements) { if (id != settlements.SettlementId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(settlements); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SettlementsExists(settlements.SettlementId)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index", "Settlements", new { i = settlements.Iddistrict })); } ViewData["IdSelectedDistrict"] = settlements.Iddistrict; return(View(settlements)); }
public async Task <ActionResult> UpdateCountryInfo([FromBody] CountryEntity countryEntity) { try { CountryEntity updatedCountry = _countryRepository.UpdateCountryInfo(countryEntity); _context.Update(updatedCountry); await _countryRepository.Save(); return(NoContent()); } catch { return(BadRequest()); } }