Ejemplo n.º 1
0
        public static void CreateNewMeal(Meal meal, List <RecipeViewModel> listOfRecipes)
        {
            var database = new SQLiteDataService();

            database.Initialize();
            database.AddMeal(meal);
            listOfRecipes.Select(recipe => new RecipeByMeal
            {
                RecipeId    = recipe.GetRecipe().Id,
                MealId      = meal.Id,
                CreatedDate = DateTime.Now,
                CreatedBy   = currentUser.Username
            }).ToList().ForEach(rbm =>
            {
                database.AddRecipeByMeal(rbm);
            });
            database.Close();
            AllUsersMeals.Add(new MealViewModel(meal));
        }