public ActionResult SearchActualite(string query, bool isSmartPhone, int offSet, int limit) { Models.ObjAcceuil model = new Models.ObjAcceuil(); if (query == null) { query = ""; } try { using (ActualiteDAL db = new ActualiteDAL()) { model.ListeActualites = db.getListeActualite(query, "background-color: white;", offSet, limit); // On récupère également le nombre d'éléments de la requete (sans le offset et la limite) model.ElementCount = db.getListeActualite(query, "background-color: white;", null, null).Count; } } catch (Exception e) { Commons.Logger.genererErreur(typeof(HomeController), "query = " + query + " : " + e.ToString()); return(RedirectToAction("AfficherErreur", "Error", new { message = e.Message })); } // S'il s'agit d'un téléphone portable, on charge une vue spéciale string view = "~/Views/Home/SearchActualite.cshtml"; if (isSmartPhone) { view = "~/Views/Home/SearchActualiteMobile.cshtml"; } return(PartialView(view, model)); }
public ActionResult SearchActualite(string query) { Models.ObjAcceuil model = new Models.ObjAcceuil(); if (query == null) { query = ""; } try { using (ActualiteDAL db = new ActualiteDAL()) { model.ListeActualites = db.getListeActualite(query); } } catch (Exception e) { Commons.Logger.genererErreur(typeof(HomeController), "query = " + query + " : " + e.ToString()); return(RedirectToAction("AfficherErreur", "Error", new { message = e.Message })); } return(PartialView(model)); }