public ActionResult FiltreTrajets(DateTime?datD, DateTime?datA, string villDepar, string villeArive) { // string tous = Session["Culture"].ToString() == "en" ? "ALL" : "Tout"; ViewBag.listVilleDep = new SelectList(_st.listVilleDep()); ViewBag.listVilleAriv = new SelectList(_st.listVilleArriv()); DateTime dD = new DateTime(); DateTime dF = new DateTime(); if (datD == null || datA == null) { dD = DateTime.Today; dF = DateTime.Today; } else { dD = (DateTime)datD; dF = (DateTime)datA; } if (User.IsInRole("Chauffeur")) { ViewBag.Delete = "Delete"; } ViewBag.Name = User.Identity.Name; List <Trajet> list = _st.ListeTrajets(); // _st.GetListeTrajetsBy(dD, dF, villDepar, villeArive); VMFiltreTrajets v = new VMFiltreTrajets { calendarD = dD, calendarF = dF, villeDepart = "villeDep", villeDestination = "villearive", listTraj = list }; return(View(v)); }
public ActionResult FiltreTrajets(VMFiltreTrajets rrr) { ViewBag.listVilleDep = new SelectList(_st.listVilleDep()); ViewBag.listVilleAriv = new SelectList(_st.listVilleArriv()); DateTime dD = (DateTime)rrr.calendarD; DateTime dF = (DateTime)rrr.calendarF; string villeDep = rrr.villeDepart; string villearive = rrr.villeDestination; List <Trajet> list = _st.GetListeTrajetsBy(dD, dF, rrr.villeDepart, rrr.villeDestination); rrr = new VMFiltreTrajets { calendarD = dD, calendarF = dF, villeDepart = rrr.villeDepart, villeDestination = rrr.villeDestination, listTraj = list }; return(View(rrr)); }