public ActionResult RedirectToAjouterOrModifierDeprt(int?id) { VMListeDeprt vmDeprt = new VMListeDeprt { listCat = BusComp.GetListeCategorieDto(0, 0, true) }; if (id != 0) { var tempDeprt = BusComp.GetDepartement((int)id); vmDeprt.id_dep = tempDeprt.id_dep; vmDeprt.id_cat = tempDeprt.id_cat; vmDeprt.nom_dep = tempDeprt.nom_dep; vmDeprt.Date_creat = tempDeprt.Date_creat; vmDeprt.description_dep = tempDeprt.description_dep; var index01 = vmDeprt.listCat.FindIndex(p => p.id_cat == tempDeprt.id_cat); var value01 = vmDeprt.listCat.Find(p => p.id_cat == tempDeprt.id_cat); vmDeprt.listCat[index01] = vmDeprt.listCat.First(); vmDeprt.listCat[0] = value01; } return(View("AjouterOrModifierDeprt", vmDeprt)); }