public ActionResult DeleteSubject(int id)
        {
            SubjectRepository subjectRepo = new SubjectRepository();
            SubjectDeleteSubjectVM model = new SubjectDeleteSubjectVM();

            Subject subject = subjectRepo.GetByID(id);

            model.SubjectID = subject.ID;
            model.SubjectName = subject.Name;

            return View(model);
        }
        public ActionResult DeleteSubject(SubjectDeleteSubjectVM model)
        {
            SubjectRepository subjectRepo = new SubjectRepository();

            Subject subject = subjectRepo.GetByID(model.SubjectID);

            if (subject.CourseSubject.Count() > 0)
            {

                ModelState.AddModelError("Error", "Subject contains teacher or course");
                model.SubjectID = subject.ID;
                model.SubjectName = subject.Name;
                return View(model);
            }

            subjectRepo.Delete(subject);

            return RedirectToAction("ListSubjects", "Subject");
        }