Exemplo n.º 1
0
        public PizzaSizeViewModel GetById(int id)
        {
            PizzaSize pizzaSize = _pizzaSizeRepository.GetById(id);

            if (pizzaSize == null)
            {
                throw new Exception($"PizzaSize with id {id} not found");
            }

            return(pizzaSize.ToViewModel());
        }
Exemplo n.º 2
0
        public IActionResult Edit(int id)
        {
            PizzaSize pizzaSize = Data.PizzaSizes.FirstOrDefault(x => x.Id == id);

            if (pizzaSize == null)
            {
                return(NotFound());
            }

            return(View(PizzaSize.ToViewModel(pizzaSize)));
        }