public ActionResult AddSpecialty(int id, int tutorSpecialty) { Tutor currentTutor = Tutor.Find(id); Specialty newSpecialty = Specialty.Find(tutorSpecialty); currentTutor.AddSpecialty(newSpecialty); return(RedirectToAction("Specialties")); }
public void AddsGetsSpecialtiess_AddsAndGetsAssociatedSpecialtiessFromDb_SpecialtyList() { Tutor newTutor = new Tutor("Sean", "Miller", "*****@*****.**", "1234567890", 1, true, "Weekends", 25.00); newTutor.Save(); Specialty newSpecialty = new Specialty("Chemistry", "Science"); newSpecialty.Save(); newTutor.AddSpecialty(newSpecialty); List <Specialty> expectedList = new List <Specialty> { newSpecialty }; List <Specialty> actualList = newTutor.GetSpecialties(); CollectionAssert.AreEqual(expectedList, actualList); }