profileShare

rasmusjy / splitapp-backend-clean-onion

Read-only snapshot

No repository description.

main default branch 429 files Expires Sep 13, 2026, 9:06 AM
BudgetCategoryRepository.cs 1,075 bytes
1 using App.Domain;
2 using App.Domain.Contracts;
3 using Microsoft.EntityFrameworkCore;
4
5 namespace App.DAL.EF.Repositories;
6
7 public class BudgetCategoryRepository : BaseRepository<BudgetCategory>, IBudgetCategoryRepository
8 {
9 public BudgetCategoryRepository(AppDbContext dbContext) : base(dbContext)
10 {
11 }
12
13 public override async Task<IEnumerable<BudgetCategory>> GetAllAsync()
14 {
15 return await DbContext.BudgetCategories
16 .Include(bc => bc.Trip)
17 .OrderBy(bc => bc.DisplayOrder)
18 .ToListAsync();
19 }
20
21 public override async Task<BudgetCategory?> GetByIdAsync(Guid id)
22 {
23 return await DbContext.BudgetCategories
24 .Include(bc => bc.Trip)
25 .FirstOrDefaultAsync(bc => bc.Id == id);
26 }
27
28 public async Task<IEnumerable<BudgetCategory>> GetByTripIdAsync(Guid tripId)
29 {
30 return await DbContext.BudgetCategories
31 .Where(bc => bc.TripId == tripId)
32 .Include(bc => bc.Expenses)
33 .OrderBy(bc => bc.DisplayOrder)
34 .ToListAsync();
35 }
36 }
37