public async Task <IActionResult> Edit(int id, ResidenceZone residenceZone) { if (id != residenceZone.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(residenceZone); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ResidenceZoneExists(residenceZone.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(residenceZone)); }
public async Task <IActionResult> Create(ResidenceZone residenceZone) { if (ModelState.IsValid) { _context.Add(residenceZone); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(residenceZone)); }