public ActionResult Login() { DLSInterface.ClassEntered = -1; ViewBag.Message = ""; DLSInterface.logout(); return(View()); }
// GET: Profile/Delete/5 public ActionResult Delete() { int id = DLSInterface.GetIdByEmail(DLSInterface.loggedEmail); SE_ProjectEntities db = new SE_ProjectEntities(); foreach (Post p in db.Posts) { if (p.email == DLSInterface.loggedEmail) { db.Posts.Remove(p); } } foreach (Profile my in db.Profiles) { if (my.Email == DLSInterface.loggedEmail) { db.Profiles.Remove(my); break; } } if (db.TeacherTbls.Find(id) != null && db.TeacherTbls.Find(id).Email == DLSInterface.loggedEmail) { db.TeacherTbls.Remove(db.TeacherTbls.Find(id)); foreach (TeacherClassOTM totm in db.TeacherClassOTMs) { if (totm.Teacher_Id == id) { db.TeacherClassOTMs.Remove(totm); } } } else { foreach (StudentClassOTM t in db.StudentClassOTMs) { if (t.Student_Id == id) { db.StudentClassOTMs.Remove(t); } } db.StudentTbls.Remove(db.StudentTbls.Find(id)); } db.SaveChanges(); DLSInterface.logout(); return(RedirectToAction("Create", "Person")); }