Move Method Body on Repositroy and inject Repository on Service

This commit is contained in:
franc
2025-04-16 17:37:11 +02:00
parent 84c75098cf
commit c07cdf7eae
3 changed files with 18 additions and 8 deletions
@@ -17,5 +17,8 @@
Task DeleteShoppingListAsync(Guid shoppingListId);
Task<Recipe?> GetRecipeByNameAndImageAsync(string recipeName, string imageFileName);
Task<int> GetShoppingListRecipeCountAsync(Guid shoppingListId);
}
}
@@ -167,5 +167,12 @@
.Include(r => r.MediaFiles.Where(mf => mf.FileName == imageFileName))
.FirstOrDefaultAsync();
}
public async Task<int> GetShoppingListRecipeCountAsync(Guid shoppingListId)
{
return await _context.RecipeShoppingLists
.Where(rsl => rsl.ShoppingList.Id == shoppingListId)
.CountAsync();
}
}
}