public ActionResult Results() { if (string.IsNullOrEmpty(Request.Params["pickupdate"])) { ViewData["myerr"] = "*Pickup date required"; return View(); } if (string.IsNullOrEmpty(Request.Params["dropoffdate"])) { ViewData["myerr"] = "*Drop off date required"; return View(); } DateTime startDate, endDate; try { startDate = Convert.ToDateTime(Request.Params["pickupdate"]); endDate = Convert.ToDateTime(Request.Params["dropoffdate"]); } catch (Exception) { ViewData["myerr"] = "*Dates are not in valid mm/dd/yyyy format"; return View(); } if (endDate < startDate || startDate < DateTime.Today) { ViewData["myerr"] = "*Journey start date is before end date and it is from current date"; return View(); } DatabaseService ds = new DatabaseService(); List<Models.SearchResult> rows = ds.getResults(Request.Params["ddlVehicleCategory"].ToString(), Request.Params["ddlBodyStyle"].ToString(), Request.Params["ddlPickUp"].ToString(), Request.Params["sort"].ToString(), startDate, endDate); if (rows.Count() != 0) { ViewData["pickupdate"] = Request.Params["pickupdate"]; ViewData["dropoffdate"] = Request.Params["dropoffdate"]; ViewData["returncity"] = Request.Params["ddlReturnCity"]; ViewData["pickupcity"] = Request.Params["ddlPickUp"]; ViewData.Model = rows; } else ViewData.Model = null; return View(); // return + Request.Params["ddlReturnCity"].ToString() + Request.Params["pickupdate"].ToString() + Request.Params["dropoffdate"].ToString(); }