public IActionResult AdminDetails(int id)
        {
            Intervention intervention     = interventions.Select(id);
            AdminInterventionViewModel vm = new AdminInterventionViewModel(intervention);

            return(View(vm));
        }
        public IActionResult ClientDetails(int id)
        {
            Intervention inter            = interventions.Select(id);              // va chercher l'objet en db
            AdminInterventionViewModel vm = new AdminInterventionViewModel(inter); // met l'objet dans mon view model

            return(View(vm));                                                      // creer une vue dynamiquement grace a l'objet qu'on injecte dedan
        }
        public IActionResult AdminEdit(AdminInterventionViewModel vm)
        {
            Intervention inter = vm.GetIntervention;

            interventions.Update(inter);
            return(RedirectToAction(nameof(InterventionsFromContractForAdmin), new { id = inter.ContractId }));
        }
        public IActionResult Edit(AdminInterventionViewModel vm)
        {
            Intervention inter = vm.GetIntervention;

            interventions.Update(inter);
            return(RedirectToAction(nameof(TechnicianInterventions)));
        }
        public IActionResult Edit(int id)
        {
            Intervention inter            = interventions.Select(id); // va chercher l'objet en db
            AdminInterventionViewModel vm = new AdminInterventionViewModel(inter);

            return(View(vm));
        }
 public IActionResult addNewIntervention(AdminInterventionViewModel intervention)
 {
     interventions.Insert(intervention.GetIntervention);
     return(RedirectToAction(nameof(InterventionsFromContractForAdmin), new { id = intervention.ContractId }));
     //ViewBag.message = $"Une nouvelle intervention à bien été ajoutée au contrat (id: {intervention.ContractId}) pour le client : {intervention.CustomerName} (id: {intervention.CustomerId})";
     //return View("~/Views/Contract/OnGoingContracts.cshtml");
 }
        public IActionResult AddInterventionToContract(int contractId)
        {
            Intervention inter = new Intervention(contractId);
            Contract     contr = contracts.Select(contractId);

            inter.InterventionAddress = Services.GetAdressFromContract(contractId);
            inter.Client = users.Select(contr.Client.UserId);
            AdminInterventionViewModel interVm = new AdminInterventionViewModel(inter);

            interVm.ContractDescription = contr.Description;
            interVm.ContractId          = contr.ContractId;
            return(View("addNewIntervention", interVm));
        }
        public IActionResult AdminUpdateContractAddIntervention(int contractId)
        {
            Intervention inter = new Intervention(contractId);
            Contract     contr = contracts.Select(contractId);

            inter.InterventionAddress = Services.GetAdressFromContract(contractId);
            inter.Client = users.Select(contr.Client.UserId);
            AdminInterventionViewModel interVm = new AdminInterventionViewModel(inter);

            interVm.ContractDescription = contr.Description;
            interVm.ContractId          = contr.ContractId;
            interventions.Insert(interVm.GetIntervention);
            return(RedirectToAction(nameof(InterventionsFromContractForAdmin), new { id = contractId }));
        }