public async Task <IActionResult> Edit(int id, [Bind("Id,Department")] Dept dept) { if (id != dept.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(dept); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DeptExists(dept.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(dept)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Category category) { if (id != category.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(category); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CategoryExists(category.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(category)); }