Example #1
0
        public PartialViewResult SubmitBikeSearch(BikeSearchViewModel viewModel)
        {
            var resultsViewModel = new SearchResultsViewModel();

            var results = _searchService.SearchBikeCards(viewModel);

            resultsViewModel.CountBikes = _searchService.GetCountAllBikes(viewModel.SearchTerm);

            foreach (var result in results)
            {
                var bike = _bikeCardService.GetBikeCardContent(result.ItemId.ToString());

                resultsViewModel.Results.Add(new SearchResultViewModel()
                {
                    Id          = result.ItemId.ToString(),
                    BikeName    = result.BikeName,
                    TypeEngine  = result.TypeEngine,
                    MaxSpeed    = result.MaxSpeed,
                    ImgUrl      = bike.Image.Src,
                    Fuel        = result.Fuel,
                    Description = result.Description,
                    Price       = result.Price
                });
            }

            return(PartialView("~/Areas/ATV/Views/Search/_BikeSearchResult.cshtml", resultsViewModel));
        }
Example #2
0
        public ViewResult BikeCardIndex()
        {
            var viewModel = new BikeCardViewModel();

            if (!String.IsNullOrEmpty(RenderingContext.Current.Rendering.DataSource))
            {
                var bikeCardContent = _bikeCardService.GetBikeCardContent(RenderingContext.Current.Rendering.DataSource);
                if (bikeCardContent != null)
                {
                    viewModel.Id          = bikeCardContent.Id;
                    viewModel.Name        = bikeCardContent.Name;
                    viewModel.TypeEngine  = bikeCardContent.TypeEngine;
                    viewModel.MaxSpeed    = bikeCardContent.MaxSpeed;
                    viewModel.Fuel        = bikeCardContent.Fuel;
                    viewModel.Description = bikeCardContent.Description;
                    viewModel.Price       = bikeCardContent.Price;
                }
            }
            return(View(viewModel));
        }