Example #1
0
        public async Task Update(Recipe recipe)
        {
            recipe.UpdateDateTime = DateTime.UtcNow;
            using (var db = new MySqlDbContext(_options.MySqlConnectionString))
            {
                var updatededRecipe = await db.AddAsync(recipe);

                await db.SaveChangesAsync();
            }
        }
Example #2
0
        public async Task <int> Create(Recipe recipe)
        {
            recipe.CreateDateTime = recipe.UpdateDateTime = DateTime.UtcNow;
            using (var db = new MySqlDbContext(_options.MySqlConnectionString))
            {
                var addedRecipe = await db.AddAsync(recipe);

                await db.SaveChangesAsync();

                return(addedRecipe.Entity.RecipeId);
            }
        }