Example #1
0
        public RecipeDto GetDto(long id)
        {
            var recipe = _cookbookContext.Recipe.SingleOrDefault(r => r.Id == id);

            if (recipe == null)
            {
                return(null);
            }

            _cookbookContext.Entry(recipe)
            .Collection(r => r.RelRecipeIngredient)
            .Query()
            .Include(r => r.Ingredient)
            .Load();

            return(Mapper.MapToDto(recipe));
        }
Example #2
0
 public async Task PutRecipe(Recipe recipe)
 {
     db.Entry(recipe).State = EntityState.Modified;
     await db.SaveChangesAsync();
 }