// POST /api/<controller>
        public IngredientDto Post(IngredientDto IngredientDto)
        {
            var IngredientIncluir = new Ingredient();
            IngredientIncluir.Name = IngredientDto.Name;
            _IngredientServico.Save(IngredientIncluir);

            IngredientDto.Id = IngredientIncluir.Id;

            return IngredientDto;
        }
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                string name = collection["Name"];
                Ingredient ingredient = new Ingredient();
                ingredient.Name = name;
                _ingredientService.Save(ingredient);

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
        private void InsertStubData()
        {
            // Insere cada um dos ingredientes
            var cebola = new Ingredient { Name = "Cebola" };
            _ingredientService.Save(cebola);

            var muçarela = new Ingredient { Name = "Muçarela" };
            _ingredientService.Save(muçarela);

            var molhoDeTomate = new Ingredient { Name = "Molho de Tomate" };
            _ingredientService.Save(molhoDeTomate);

            var ovo = new Ingredient { Name = "Ovo" };
            _ingredientService.Save(ovo);

            var calabreza = new Ingredient { Name = "Calabresa" };
            _ingredientService.Save(calabreza);

            var pizza = new Pizza { Name = "Portuguesa" };

            pizza.AddIngredient(molhoDeTomate);
            pizza.AddIngredient(cebola);
            pizza.AddIngredient(ovo);
            _pizzaService.Save(pizza);

            pizza = new Pizza { Name = "Calabresa" };
            pizza.AddIngredient(molhoDeTomate);
            pizza.AddIngredient(cebola);
            pizza.AddIngredient(calabreza);
            _pizzaService.Save(pizza);

            pizza = new Pizza { Name = "Muçarela" };
            pizza.AddIngredient(molhoDeTomate);
            pizza.AddIngredient(muçarela);
            _pizzaService.Save(pizza);

            pizza = new Pizza { Name = "Pizza de vento" };
            _pizzaService.Save(pizza);
        }
 public virtual void AddIngredient(Ingredient ingredient)
 {
     Ingredients.Add(ingredient);
 }
 public void Save(Ingredient ingredient)
 {
     _ingredientDAO.Save(ingredient);
 }