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)); }
public async Task PutRecipe(Recipe recipe) { db.Entry(recipe).State = EntityState.Modified; await db.SaveChangesAsync(); }