public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Continent continent) { if (id != continent.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(continent); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ContinentExists(continent.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("manageSchools", "Admin")); } return(View(continent)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Mobile,Continent_id,Country,City_id")] School school) { if (id != school.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(school); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SchoolExists(school.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewBag.Continents = new SelectList(_context.Continent.ToList(), "Id", "Name"); ViewBag.Cities = new SelectList(_context.City.ToList(), "Id", "Name"); return(View(school)); }