Esempio n. 1
0
        public ViewResult Index()
        {
            var viewProducts = _pieRepository.PiesOfTheWeek.Take(3).OrderBy(p => p.Name).Select(x => (_pieDetailRepository.MapDbPieDetailToPieDetailViewModel(x)));

            var homeViewModel = new HomeViewModel
            {
                PiesOfTheWeek = viewProducts,
                HostUrl       = this.Request.HostUrl(),
                IsMobile      = this.Request.IsMobile()
            };

            return(View(homeViewModel));
        }
        public async Task <ViewResult> List()
        {
            var viewProducts = _pieDetailRepository.PieDetailsWithChildren.OrderBy(p => p.Name).Select(x => (_pieDetailRepository.MapDbPieDetailToPieDetailViewModel(x)));

            var products = await _catalogRepository
                           .GetAll(x => x.IsActive && x.IsOnSale && x.Category.ToLower() != "lunch" && x.Category.ToLower() != "appetizer");

            // Dictionary<int, string> times = _pieDetailRepository.TimeEstimations(products);

            return(View(new PieDetailsListViewModel
            {
                PieDetails = viewProducts,
                CurrentCategory = "Todos los productos",
                CatalogProducts = products.Select(x => _mapper.Map <Product, ProductEstimationViewModel>(x)).Select(x => { x.Estimation = "" /*times[x.PreparationTime]*/; return x; })
            }));
        }