Exemplo n.º 1
0
        public ActionResult Destroy(int id)
        {
            Speciality deleteSpeciality = Speciality.Find(id);

            deleteSpeciality.Delete();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public ActionResult Delete(int id)
        {
            Speciality thisSpeciality = Speciality.Find(id);

            thisSpeciality.Delete();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        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"));
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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 }));
 }