コード例 #1
0
        public IActionResult Menu()
        {
            List <Pizza>          menu       = _pizzaOrderService.GetMenu();
            List <PizzaViewModel> pizzasView = new List <PizzaViewModel>();

            foreach (var pizza in menu)
            {
                pizzasView.Add(new PizzaViewModel()
                {
                    Id    = pizza.Id,
                    Image = pizza.Image,
                    Name  = pizza.Name,
                    Price = pizza.Price,
                    Size  = pizza.PizzaSize
                });
            }
            MenuViewModel model = new MenuViewModel()
            {
                Pizzas = pizzasView
            };

            return(View(model));
        }
コード例 #2
0
        public IActionResult Menu()
        {
            var menu = _pizzaOrderService.GetMenu();

            return(View(menu));
        }