public IActionResult DeleteStudent(string id, string returnUrl = null)
        {
            SeminarPapersLogic seminarPapersLogic = new SeminarPapersLogic(_context);
            //FinalPapersLogic finalPapersLogic = new FinalPapersLogic(_context);
            StudentLogic studentLogic = new StudentLogic(_context);
            Student      s            = studentLogic.GetById(id);

            studentLogic.Delete(s.Id);
            s.SeminarPapers.ForEach(sp => seminarPapersLogic.Delete(sp.SeminarPaperId));
            //s.FinalPapers.ForEach(sp => finalPapersLogic.Delete(sp.FinalPaperId));

            return(RedirectToAction("Users"));
        }
 public IActionResult Delete(int seminarPaperId)
 {
     try
     {
         ISeminarPapersLogic seminarPaperLogic = new SeminarPapersLogic(_context);
         seminarPaperLogic.Delete(seminarPaperId);
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex));
     }
 }
        public IActionResult DeleteProfessor(string id, string returnUrl = null)
        {
            SeminarPapersLogic    seminarPapersLogic    = new SeminarPapersLogic(_context);
            ProfessorSubjectLogic professorSubjectLogic = new ProfessorSubjectLogic(_context);
            //FinalPapersLogic finalPapersLogic = new FinalPapersLogic(_context);
            ProfessorLogic          professorLogic = new ProfessorLogic(_context);
            Professor               p  = professorLogic.GetById(id);
            List <ProfessorSubject> ps = professorSubjectLogic.GetByProfessorId(id).ToList();

            p.ProfessorSubjects = ps;

            ps.ToList().ForEach(pp => pp.SeminarPapers.ToList().ForEach(sp2 => seminarPapersLogic.Delete(sp2.SeminarPaperId)));
            ps.ToList().ForEach(p1 => professorSubjectLogic.Delete(p1.ProfessorId, p1.SubjectId));
            professorLogic.Delete(p.Id);
            //p.FinalPapers.ForEach(fp => finalPapersLogic.Delete(fp.FinalPaperId));

            return(RedirectToAction("Users"));
        }