/*public ActionResult DeleteConfirmed(int id) * { * if (Session["id"] == null) * { * TempData["login"] = "******"; * return RedirectToAction("Login", "Login"); * } * if (!Session["id"].Equals(id)) * { * TempData["auth"] = "You are not Authorized so move back"; * return RedirectToAction("Index", "Employees"); * } * Employee employee = db.employees.Find(id); * Educational_details ed; * if((ed=db.Educational_details.Find(id))!=null) * { * db.Educational_details.Remove(ed); * } * Training_Details td; * if((td = db.Training_Details.Find(id))!=null) * { * db.Training_Details.Remove(td); * } * Auth a; * if((a= db.auths.Find(id))!=null) * { * db.auths.Remove(a); * } * Turnkey_Project tp; * if((tp= db.Turnkey_Project.Find(id))!=null) * { * db.Turnkey_Project.Remove(tp); * } * Workshop_Details wd; * if((wd= db.Workshop_Details.Find(id))!=null) * { * db.Workshop_Details.Remove(wd); * } * Confirmation c; * if((c= db.Confirmations.Find(id))!=null) * { * db.Confirmations.Remove(c); * } * db.employees.Remove(employee); * string path = @"C:\Users\Kishan\source\repos\Project\Project\directory\" + employee.Name; * string path1; * path1= path + @"\" + "Educational_Certificates"; * DirectoryInfo di; * di= new DirectoryInfo(path1); * foreach (FileInfo filename in di.GetFiles()) * { * filename.Delete(); * } * Directory.Delete(path1); * path1 = path + @"\" + "Workshop_Certificates"; * di = new DirectoryInfo(path1); * foreach (FileInfo filename in di.GetFiles()) * { * filename.Delete(); * } * Directory.Delete(path1); * path1 = path + @"\" + "Training_Certificates"; * di = new DirectoryInfo(path1); * foreach (FileInfo filename in di.GetFiles()) * { * filename.Delete(); * } * Directory.Delete(path1); * Directory.Delete(path); * path = @"C:\Users\Kishan\source\repos\Project\Project\confirmation_certificate\" + employee.Name; * path1 = path + @"\" + "Educational"; * di = new DirectoryInfo(path1); * foreach (FileInfo filename in di.GetFiles()) * { * filename.Delete(); * } * Directory.Delete(path1); * path1 = path + @"\" + "Workshop"; * di = new DirectoryInfo(path1); * foreach (FileInfo filename in di.GetFiles()) * { * filename.Delete(); * } * Directory.Delete(path1); * path1 = path + @"\" + "Training"; * di = new DirectoryInfo(path1); * foreach (FileInfo filename in di.GetFiles()) * { * filename.Delete(); * } * Directory.Delete(path1); * Directory.Delete(path); * db.SaveChanges(); * return RedirectToAction("Index"); * }*/ protected override void Dispose(bool disposing) { if (disposing) { db.Dispose(); } base.Dispose(disposing); }
public void Dispose() { ApplicationUser.Dispose(); Department.Dispose(); Role.Dispose(); Worker.Dispose(); Project.Dispose(); }