Пример #1
0
        public void TestAddRecipe()
        {
            var recipe = new Recipe()
            {
                Name = "foo"
            };
            var ingredient = new Ingredient()
            {
                Name = "Ingredient"
            };

            recipe.AddRecipeIngredient(ingredient, 1, Units.oz);

            repo.Add(recipe);

            var result = repo.Get(recipe.Name);

            Assert.IsTrue(result.Count == 1);
            Assert.IsTrue(result[0].Name == recipe.Name);
        }
Пример #2
0
        public void AddRecipe(RecipeDTO recipe, string currentUser)
        {
            Recipe dbRecipe = new Recipe()
            {
                Id          = recipe.Id,
                Title       = recipe.Title,
                ImageUrl    = recipe.ImageUrl,
                DateCreated = DateTime.Now,
                Notes       = recipe.Notes,
                CatId       = recipe.CatId,
                //CatReference = (Category)recipe.Catetory,
                //MenuId = recipe.Menu.Id,
                UserId = _uRepo.getCurrentUser(currentUser).First().Id
            };

            _rRepo.Add(dbRecipe);
        }