Implement a method to get whole shoppinglist model
This commit is contained in:
@@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
Task<Recipe?> GetRecipeByNameAndImageAsync(string recipeName, string imageFileName);
|
Task<Recipe?> GetRecipeByNameAndImageAsync(string recipeName, string imageFileName);
|
||||||
|
|
||||||
|
Task<ShoppingList?> GetByIdAsync(Guid shoppingListId);
|
||||||
|
|
||||||
Task<int> CountAllRecipeShoppinglistsAsync();
|
Task<int> CountAllRecipeShoppinglistsAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,6 +109,22 @@
|
|||||||
return shoppingList;
|
return shoppingList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<ShoppingList?> GetByIdAsync(Guid shoppingListId)
|
||||||
|
{
|
||||||
|
return await _context.ShoppingLists
|
||||||
|
.Include(sl => sl.RecipeShoppingList)
|
||||||
|
.ThenInclude(rsl => rsl.Recipe)
|
||||||
|
.Include(sl => sl.RecipeShoppingList)
|
||||||
|
.ThenInclude(rsl => rsl.SelectedIngredients)
|
||||||
|
.ThenInclude(si => si.RecipeIngredient)
|
||||||
|
.ThenInclude(ri => ri.Ingredient)
|
||||||
|
.Include(sl => sl.RecipeShoppingList)
|
||||||
|
.ThenInclude(rsl => rsl.SelectedIngredients)
|
||||||
|
.ThenInclude(si => si.RecipeIngredient)
|
||||||
|
.ThenInclude(ri => ri.Unit)
|
||||||
|
.FirstOrDefaultAsync(sl => sl.Id == shoppingListId);
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<RecipeIngredientShoppingList>> GetIngredientsOfRecipeInListAsync(Guid shoppingListRecipeId)
|
public async Task<IEnumerable<RecipeIngredientShoppingList>> GetIngredientsOfRecipeInListAsync(Guid shoppingListRecipeId)
|
||||||
{
|
{
|
||||||
return await _context.RecipeIngredientsShoppingLists
|
return await _context.RecipeIngredientsShoppingLists
|
||||||
|
|||||||
Reference in New Issue
Block a user