SettlementPaymentRepository.cs
929 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 SettlementPaymentRepository : BaseRepository<SettlementPayment>, ISettlementPaymentRepository |
| 8 | { |
| 9 | public SettlementPaymentRepository(AppDbContext dbContext) : base(dbContext) |
| 10 | { |
| 11 | } |
| 12 | |
| 13 | public override async Task<IEnumerable<SettlementPayment>> GetAllAsync() |
| 14 | { |
| 15 | return await DbContext.SettlementPayments |
| 16 | .Include(sp => sp.FromUser) |
| 17 | .Include(sp => sp.ToUser) |
| 18 | .Include(sp => sp.SettlementPlan) |
| 19 | .ToListAsync(); |
| 20 | } |
| 21 | |
| 22 | public override async Task<SettlementPayment?> GetByIdAsync(Guid id) |
| 23 | { |
| 24 | return await DbContext.SettlementPayments |
| 25 | .Include(sp => sp.FromUser) |
| 26 | .Include(sp => sp.ToUser) |
| 27 | .Include(sp => sp.SettlementPlan) |
| 28 | .FirstOrDefaultAsync(sp => sp.Id == id); |
| 29 | } |
| 30 | } |
| 31 | |