This commit is contained in:
Zeeshaun
2026-03-13 09:27:34 -05:00
parent 256f579489
commit a675c5f5b0
381 changed files with 20992 additions and 0 deletions
@@ -0,0 +1,46 @@
using LCU.API.Internal.RepoApi.Repos.Extensions;
using LCU.API.Internal.RepoApi.Repos.Models;
using LCU.API.Internal.RepoApi.Repos.Persistence;
using Microsoft.EntityFrameworkCore;
namespace LCU.API.Internal.RepoApi.Repos.Repositories
{
public class CollateralRepository : BaseRepository, ICollateralRepository
{
public CollateralRepository(AppDbContext context) : base(context)
{
}
public async Task<IEnumerable<Collateral>> ListAllAsync()
{
return await _context.Collaterals.IncludeAll().ToListAsync();
}
public async Task<Collateral> AddAsync(Collateral collateral)
{
var result = await _context.Collaterals.AddAsync(collateral);
return result.Entity;
}
public async Task<Collateral> FindByIdAsync(int id)
{
return await Queryable.Where<Collateral>(_context.Collaterals, c => c.CollateralId == id).IncludeAll().FirstOrDefaultAsync();
}
public async Task<IEnumerable<Collateral>> FindByRepoIdAsync(int repoId)
{
return await Queryable.Where<Collateral>(_context.Collaterals, c => c.RepoId == repoId).IncludeAll().ToListAsync();
}
public void Update(Collateral collateral)
{
_context.Collaterals.Update(collateral);
}
public void Remove(Collateral collateral)
{
_context.Collaterals.Remove(collateral);
}
}
}