public PartialViewResult SubmitTripSearch(TripSearchViewModel viewModel) { var resultsViewModel = new TripSearchResultsViewModel(); var results = _searchService.SearchTripCards(viewModel); resultsViewModel.CountTrips = _searchService.GetCountAlTrips(viewModel.SearchTerm); foreach (var result in results) { var trip = _tripCardService.GetTripCardContent(result.ItemId.ToString()); resultsViewModel.Results.Add(new TripSearchResultViewModel() { Id = result.ItemId.ToString(), Title = result.Title, Description = result.Description, ImgUrl = trip.Image.Src, StartDate = result.StartDate, EndDate = result.EndDate, Price = result.Price }); } return(PartialView("~/Areas/ATV/Views/Search/_TripSearchResult.cshtml", resultsViewModel)); }
public ViewResult TripCardIndex() { var viewModel = new TripCardViewModel(); if (!String.IsNullOrEmpty(RenderingContext.Current.Rendering.DataSource)) { var tripCardContent = _tripCardService.GetTripCardContent(RenderingContext.Current.Rendering.DataSource); if (tripCardContent != null) { viewModel.Id = tripCardContent.Id; viewModel.ImageUrl = tripCardContent.Image.Src; viewModel.Title = tripCardContent.Title; viewModel.Description = tripCardContent.Description; viewModel.StartDate = tripCardContent.StartDate; viewModel.EndDate = tripCardContent.EndDate; viewModel.Price = tripCardContent.Price; } } return(View("~/Areas/TripCard/Views/TripCardContent/TripCardIndex.cshtml", viewModel)); }