public async Task <IActionResult> Edit(int id, [Bind("ID,mentorID,subjectID")] MentorSubjects mentorSubjects) { if (id != mentorSubjects.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(mentorSubjects); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MentorSubjectsExists(mentorSubjects.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(mentorSubjects)); }
public async Task <IActionResult> Create([Bind("ID,mentorID,subjectID")] MentorSubjects mentorSubjects) { if (ModelState.IsValid) { _context.Add(mentorSubjects); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(mentorSubjects)); }