public ActionResult Delete(Guid id) { ExpanseRepositery expRepo = new ExpanseRepositery(); ExpanseRepportRepositery expRapRep = new ExpanseRepportRepositery(); Expanses exp = expRepo.GetById(id); Guid idExpRapo = exp.ExpanseReport_ID; ExpanseReports expReport = expRapRep.GetById(idExpRapo); double ttc = expReport.Total_TTC - exp.Amount_TTC; double ht = expReport.Total_HT - exp.Amount_HT; double tva = expReport.Total_TVA - exp.Amount_TVA; expRapRep.updateExpanseReports(expReport, ttc, ht, tva); expRepo.Delete(exp); expRepo.Save(); return(RedirectToAction("AllExpanses", new { idExpanseReport = idExpRapo })); }
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) { ExpanseTypesRepositery expTypeRepo = new ExpanseTypesRepositery(); ExpanseRepositery expRep = new ExpanseRepositery(); List <Expanses> expList = expRep.GetExpansesByIdExpanseTypes(id).ToList(); foreach (var expanse in expList) { expRep.Delete(expanse); } expRep.Save(); ExpanseTypes expanseType = expTypeRepo.getById(id); expTypeRepo.delete(expanseType); expTypeRepo.Save(); return(RedirectToAction("AllExpanseTypes")); }
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")); }