public ActionResult <bool> AddIngredient([FromBody] IngredientResource ingredient)
        {
            _context.Add(new Ingredient {
                Name = ingredient.Name, Alcoholic = ingredient.Alcoholic
            });
            var added = _context.SaveChanges();

            return(added > 0);
        }
Example #2
0
        public ActionResult <bool> AddDrink([FromBody] Drink recipe)
        {
            var drink = new Drink
            {
                Name         = recipe.Name,
                Instructions = recipe.Instructions
            };

            _context.Add(drink);
            _context.AddRange(recipe.Volumes);

            var saved = _context.SaveChanges();

            return(saved > 0);
        }