public ActionResult EditPizza(int id)
        {
            ServiceRepository   serviceObj = new ServiceRepository();
            HttpResponseMessage response   = serviceObj.GetResponse("api/pizza/getPizza/" + id);

            response.EnsureSuccessStatusCode();
            JObject pizza = JObject.Parse(response.Content.ReadAsStringAsync().Result);

            PizzaViewModel result = new PizzaViewModel();

            result.Pizza             = new Pizza();
            result.Pizza.Id          = pizza["Id"].Value <int>();
            result.Pizza.Name        = pizza["Name"].Value <string>();
            result.Pizza.Ingredients = new List <Ingredient>();
            foreach (JObject ingre in (JArray)pizza["Ingredients"])
            {
                result.Pizza.Ingredients.Add(new Ingredient {
                    Id = ingre["Id"].Value <int>(), Name = ingre["Name"].Value <string>()
                });
            }

            IngredientController ingredientController = new IngredientController();
            var allIngredients = ingredientController.GetAll();

            result.AllIngredients = allIngredients.Select(o => new SelectListItem
            {
                Text  = o.Name,
                Value = o.Id.ToString()
            });

            ViewBag.Title = "Edit Pizza";
            return(View(result));
        }
        public ActionResult Create()
        {
            IngredientController ingredientController = new IngredientController();
            var allIngredients = ingredientController.GetAll();

            ViewBag.AllIngredients = allIngredients.Select(o => new SelectListItem
            {
                Text  = o.Name,
                Value = o.Id.ToString()
            });

            PizzaViewModel pizzaViewModel = new PizzaViewModel();

            pizzaViewModel.Pizza             = new Pizza();
            pizzaViewModel.Pizza.Ingredients = new List <Ingredient>();
            pizzaViewModel.Pizza.Name        = "Sample";
            return(View(pizzaViewModel));
        }