public ActionResult Delete(Guid id) { ProjetRepositery prjtRepo = new ProjetRepositery(); Projects project = prjtRepo.GetById(id); ExpanseRepositery expRep = new ExpanseRepositery(); ExpanseRepportRepositery expRepRep = new ExpanseRepportRepositery(); List <Expanses> expList = expRep.GetByProject(id).ToList(); foreach (var expanse in expList) { expRep.Delete(expanse); } expRep.Save(); prjtRepo.Delete(project); prjtRepo.Save(); return(RedirectToAction("AllProjets")); }
public ActionResult Delete(Guid id) { ProjetController prjtControleur = new ProjetController(); CustomerRepositery cutoRepo = new CustomerRepositery(); Customers cutomer = cutoRepo.GetById(id); ProjetRepositery prjtRepo = new ProjetRepositery(); List <Projects> projets = prjtRepo.GetByCustomerId(id).ToList(); foreach (var pro in projets) { prjtControleur.Delete(pro.Project_ID); } prjtRepo.Save(); cutoRepo.Delete(cutomer); cutoRepo.Save(); return(RedirectToAction("AllCustomer")); }
public ActionResult Delete(Guid id) { PolesRepository poleRep = new PolesRepository(); ProjetRepositery prjtRepo = new ProjetRepositery(); ExpanseRepositery expRep = new ExpanseRepositery(); EmployesRepositery empRepo = new EmployesRepositery(); ExpanseRepportRepositery expRepRep = new ExpanseRepportRepositery(); List <Projects> projets = prjtRepo.GetByIdPole(id).ToList(); foreach (var pro in projets) { List <Expanses> expList = expRep.GetByProject(pro.Project_ID).ToList(); foreach (var expanse in expList) { expRep.Delete(expanse); } expRep.Save(); prjtRepo.Delete(pro); } prjtRepo.Save(); foreach (var empl in empRepo.getByIdPole(id)) { List <ExpanseReports> expanseReports = expRepRep.GetByEmployesId(empl.Employee_ID).ToList(); foreach (var expRepo in expanseReports) { expRepRep.Delete(expRepo); } expRepRep.Save(); empRepo.Delete(empl); } empRepo.Save(); Poles pole = poleRep.GetById(id); poleRep.Delete(pole); poleRep.Save(); return(RedirectToAction("AllPoles")); }