Example #1
0
        public ActionResult Show(int id)
        {
            Dictionary <string, object> model = new Dictionary <string, object>(); // pa - sp do - do
            Speciality    selectedSpeciality  = Speciality.Find(id);
            List <Doctor> specialityDoctors   = selectedSpeciality.GetDoctors();
            List <Doctor> allDoctors          = Doctor.GetAll();

            model.Add("selectedSpeciality", selectedSpeciality);
            model.Add("specialityDoctors", specialityDoctors);
            model.Add("allDoctors", allDoctors);
            return(View(model));
        }
Example #2
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"));
        }