public async Task <IActionResult> Edit(int id, [Bind("InstructorId,Name,YearOfBirth,PhoneNumber,Email")] Instructor instructor) { if (id != instructor.InstructorId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(instructor); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InstructorExists(instructor.InstructorId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(instructor)); }
public async Task <IActionResult> Edit(int id, [Bind("DrivingCategoryId,CategoryName,Price")] DrivingCategory drivingCategory) { if (id != drivingCategory.DrivingCategoryId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(drivingCategory); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DrivingCategoryExists(drivingCategory.DrivingCategoryId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(drivingCategory)); }
public async Task <IActionResult> Edit(int id, [Bind("UserId,Name")] User user) { if (id != user.UserId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(user); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserExists(user.UserId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(user)); }