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)); }
public ActionResult ViewCarInfo(CarRentViewVM obj) { CarInfoVM objToPass = new CarInfoVM(obj); return(View(objToPass)); }