Files
ERP_Distribution/Distribution/Features/RecurringExpense/RecurringExpenseRepository.cs
T
Kalana B. Thilakarathna c775146b64
CI/CD - ERP Distribution / Build & Deploy Frontend (pull_request) Failing after 13m39s
CI/CD - ERP Distribution / Build & Deploy Backend (pull_request) Failing after 15m1s
10.
Implementation
A partner, not just software
HexDive Technologies' local team handles setup, data migration, training and ongoing support — in Sinhala, Tamil and English. [confirm]

1
Discovery
Map your network, products and processes.

2
Configuration
Set up depots, pricing, schemes, routes and users.

3
Migration & training
Move your data and train every team.

4
Go-live & support
Dedicated account manager and local support desk.
2026-10-22 17:47:49 +05:30

40 lines
1.5 KiB
C#

using Distribution.Data;
using Microsoft.EntityFrameworkCore;
namespace Distribution.Features.RecurringExpense;
public class RecurringExpenseRepository(AppDBContext context) : IRecurringExpenseRepository
{
private IQueryable<Models.RecurringExpenseTemplate> Base() =>
context.RecurringExpenseTemplates
.Include(t => t.Category)
.Include(t => t.Warehouse)
.Include(t => t.Vendor);
public async Task<Models.RecurringExpenseTemplate?> GetByIdAsync(Guid id) =>
await Base().FirstOrDefaultAsync(t => t.Id == id);
public async Task<List<Models.RecurringExpenseTemplate>> ListAsync(int page, int pageSize) =>
await Base()
.Where(t => t.IsActive)
.OrderBy(t => t.IsPaused).ThenBy(t => t.NextRunDate)
.Skip((page - 1) * pageSize)
.Take(pageSize)
.ToListAsync();
public async Task<int> CountAsync() =>
await context.RecurringExpenseTemplates.CountAsync(t => t.IsActive);
public async Task<List<Models.RecurringExpenseTemplate>> ListDueAsync(DateTime asOf) =>
await Base()
.Where(t => t.IsActive && !t.IsPaused && t.NextRunDate <= asOf
&& (t.EndDate == null || t.EndDate >= asOf))
.ToListAsync();
public async Task AddAsync(Models.RecurringExpenseTemplate entity) =>
await context.RecurringExpenseTemplates.AddAsync(entity);
public void Update(Models.RecurringExpenseTemplate entity) =>
context.RecurringExpenseTemplates.Update(entity);
}