public ActionResult Destroy(int id) { Speciality deleteSpeciality = Speciality.Find(id); deleteSpeciality.Delete(); return(RedirectToAction("Index")); }
public ActionResult Delete(int id) { Speciality thisSpeciality = Speciality.Find(id); thisSpeciality.Delete(); return(RedirectToAction("Index")); }
public ActionResult Destroy(int id) { Speciality deleteSpeciality = Speciality.Find(id); List <Doctor> deleteDoctors = deleteSpeciality.GetDoctors(); foreach (Doctor doctor in deleteDoctors) { doctor.Delete(); } deleteSpeciality.Delete(); return(RedirectToAction("Index")); }
public void Delete_SpecialityDeletedFromDB_True() { //Arrange Speciality specialityOne = new Speciality("Cutting"); specialityOne.Save(); int id = specialityOne.GetId(); Speciality defaultSpeciality = new Speciality("", 0); //Act Speciality.Delete(id); Speciality notFound = Speciality.Find(id); //Assert Assert.AreEqual(notFound, defaultSpeciality); }
public void Delete_DeletesSpecialityFromDatabase_SpecialityList() { Speciality testSpeciality = new Speciality("Cut"); testSpeciality.Save(); Stylist testStylist = new Stylist("Emmaline", "Has an experience in the beauty industry."); testStylist.Save(); testSpeciality.AddStylist(testStylist); testSpeciality.Delete(); List <Speciality> resultStylistSpecialities = testStylist.GetSpecialities(); List <Speciality> testStylistSpecialities = new List <Speciality> { }; CollectionAssert.AreEqual(resultStylistSpecialities, testStylistSpecialities); }
public void Delete_Test() { //Arrange Speciality newSpeciality = new Speciality("keratin express"); newSpeciality.Save(); Speciality newSpeciality1 = new Speciality("hair perming"); newSpeciality1.Save(); //Act newSpeciality.Delete(); List <Speciality> result = Speciality.GetAllSpecialitys(); List <Speciality> expectedResult = new List <Speciality> { newSpeciality1 }; //Assert CollectionAssert.AreEqual(expectedResult, result); }
public ActionResult DeleteFromStylistDetails(int id, int stylistId) { Speciality.Delete(id); return(RedirectToAction("Details", "Stylists", new { id = stylistId })); }
public ActionResult Delete(int id) { Speciality.Delete(id); return(RedirectToAction("Index", "Home", new { activeId = 3 })); }