public IActionResult CreatePizza([Bind("SizeID,CrustID,PresetID,ToppingIDs,MaxToppings,Amount")] PizzaModel pizza) { if (order == null) { return(RedirectToAction("CreateOrder")); } try { if (!ModelState.IsValid) { ViewBag.Restaurant = ModelMapper.Map(RestaurantController.Repository.Read((int)order.Restaurant.ID)); return(View()); } pizza.InitFromRestaurant(ModelMapper.Map(RestaurantController.Repository.Read((int)order.Restaurant.ID))); order.AddPizza(pizza); return(RedirectToAction("CreateOrder")); } catch (Exception e) { ViewBag.Restaurant = ModelMapper.Map(RestaurantController.Repository.Read((int)order.Restaurant.ID)); return(View()); } }