public IActionResult Index() { var preferedFoods = _foodService.GetPreferred(10); var model = _mapper.FoodsToHomeIndexModel(preferedFoods); return(View(model)); }
private HomeIndexModel BuildIndexModel() { var preferedFoods = _foodService.GetPreferred(2); var foods = preferedFoods.Select(food => new FoodListingModel { Id = food.Id, Name = food.Name, //Category = BuildCategoryListing(food.Category), ImageUrl = food.ImageUrl, InStock = food.InStock, Price = food.Price, ShortDescription = food.ShortDescription }); return(new HomeIndexModel { PreferedFoods = foods }); }