// Temp ActionResult for static run public ActionResult SearchResults() { CarRentIndexVM obj = new CarRentIndexVM() { desCity = "Tel aviv", desCountry = "Israel", edate = "19.06.2018", sdate = "18.06.2018", }; return(SubmitSearch(obj)); }
public ActionResult SubmitSearchGeneral(GeneralIndexVM obj) { CarRentIndexVM car = new CarRentIndexVM() { desCity = obj.desCity, desCountry = obj.desCountry, sdate = obj.startDate, edate = obj.endDate, }; return(SubmitSearch(car)); }
private CarRentIndexVM LoadCities() { CarRentIndexVM fivm = new CarRentIndexVM(); DataLayer dl = new DataLayer(); fivm.desCountries = (from u in dl.locations select u.country).ToList <string>().GroupBy(p => p) .Select(g => g.First()).OrderBy(q => q) .ToList(); fivm.desCities = (from u in dl.locations where u.country == fivm.desCountries.FirstOrDefault() select u.city).ToList <string>().GroupBy(p => p) .Select(g => g.First()).OrderBy(q => q) .ToList(); return(fivm); }
public ActionResult SubmitSearch(CarRentIndexVM carsData) { DataLayer dl = new DataLayer(); carsData.desCode = (from u in dl.locations where u.city.ToLower() == carsData.desCity.ToLower() select u.code).ToList <string>().FirstOrDefault(); // create a list of cars with api CarRentSearch crs = new CarRentSearch(); crs.FillData(carsData.desCode, carsData.sdate, carsData.edate); CarRentSearchResultsVM carRentSearchResultsVM = new CarRentSearchResultsVM() { latitude = crs.GetLatitude(), longitude = crs.GetLongitude(), PickupDate = crs.GetPickupDate(), DropoffDate = crs.GetDropoffDate(), LocationCodeCity = crs.GetLocationCodeCity(), provider = crs.GetProvider(), branch_id = crs.GetBranch(), airport = crs.GetAirport(), address = crs.GetAddress(), cars = crs.GetCars(), }; CarRentViewVM cr = new CarRentViewVM(carRentSearchResultsVM); cr.Country = carsData.desCountry; cr.City = carsData.desCity; // for the google map string realCode = crs.GetLocation(carsData.desCode, "firstStage"); string[] loc = crs.GetLocation(realCode, "secondStage").Split(','); cr.latitude = Double.Parse(loc[0]); cr.longitude = Double.Parse(loc[1]); return(View("SearchResults", cr)); }