public async Task <IActionResult> Edit(int id, [Bind("UserId,FirstName,LastName,DateOfBirth,Email,Address,UserType,CostPerWeek")] BaseUser baseUser) { if (id != baseUser.UserId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(baseUser); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BaseUserExists(baseUser.UserId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(baseUser)); }
public async Task <IActionResult> Edit(int id, [Bind("SubjectId,Name,TeacherId,CourseId,LessonDuration,DescriptionOne,DescriptionTwo,DescriptionThree,DescriptionFour")] IndividualSubject individualSubject) { if (id != individualSubject.SubjectId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(individualSubject); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!IndividualSubjectExists(individualSubject.SubjectId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(individualSubject)); }
public async Task <IActionResult> Edit(int id, [Bind("CourseId,Name,CourseDescription,TeacherId")] Course course) { if (id != course.CourseId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(course); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CourseExists(course.CourseId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(course)); }