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()); }
public IActionResult Edit(int id) { PizzaSize pizzaSize = Data.PizzaSizes.FirstOrDefault(x => x.Id == id); if (pizzaSize == null) { return(NotFound()); } return(View(PizzaSize.ToViewModel(pizzaSize))); }