public ActionResult edit(Guid id)
        {
            ProjetRepositery prtRep    = new ProjetRepositery();
            Projects         projet    = prtRep.GetById(id);
            ProjectsModel    prjtModel = new ProjectsModel();

            prjtModel.Project_ID  = projet.Project_ID;
            prjtModel.Name        = projet.Name;
            prjtModel.Description = projet.Description;
            prjtModel.Budget      = projet.Budget;
            prjtModel.Customer_ID = projet.Customer_ID;
            prjtModel.Pole_ID     = projet.Pole_ID;
            return(View("EditProject", prjtModel));
        }
        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 updateProject(Guid id)
        {
            ProjetRepositery prtRep    = new ProjetRepositery();
            ProjectsModel    prjtModel = new ProjectsModel();
            Projects         projet    = prtRep.GetById(id);

            if (!ModelState.IsValidField("Name") || !ModelState.IsValidField("Budget"))
            {
                prjtModel.Project_ID    = projet.Project_ID;
                prjtModel.Name          = projet.Name;
                prjtModel.Description   = projet.Description;
                prjtModel.CustomersList = prtRep.getAllCustomers().ToList();
                prjtModel.PolesList     = prtRep.getAllPoles().ToList();
                return(View("EditProject", prjtModel));
            }

            String name        = Convert.ToString(Request.Form["Name"]);
            string description = Convert.ToString(Request.Form["Description"]);
            double budget      = Convert.ToDouble(Request.Form["Budget"]);

            prtRep.updateProject(projet, name, description, budget);
            return(RedirectToAction("AllProjets"));
        }