public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] WaterProtection waterProtection) { if (id != waterProtection.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(waterProtection); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WaterProtectionExists(waterProtection.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(waterProtection)); }
public async Task <IActionResult> Create([Bind("Id,Name")] WaterProtection waterProtection) { if (ModelState.IsValid) { _context.Add(waterProtection); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(waterProtection)); }