Adding
This commit is contained in:
+52
@@ -0,0 +1,52 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Results;
|
||||
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public class AuctionAssignmentNoteRepository : BaseRepository, IAuctionAssignmentNoteRepository
|
||||
{
|
||||
public AuctionAssignmentNoteRepository(AppDbContext context) : base(context) { }
|
||||
|
||||
public async Task<PagedResult<AuctionAssignmentNote>> ListAllAsync(int filterPage, int filterLimit)
|
||||
{
|
||||
var results = new PagedResult<AuctionAssignmentNote>();
|
||||
var skip = (filterPage - 1) * filterLimit;
|
||||
|
||||
var temp = Queryable.OrderByDescending(from x in _context.AuctionAssignmentNotes
|
||||
select x, x => x.Id);
|
||||
|
||||
results.Total = temp.Count();
|
||||
results.Items = await temp.Skip(skip).Take(filterLimit).ToListAsync();
|
||||
return results;
|
||||
}
|
||||
|
||||
public async Task<AuctionAssignmentNote> FindByIdAsync(int id)
|
||||
{
|
||||
return await Queryable.Where(_context.AuctionAssignmentNotes, c => c.Id == id).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<AuctionAssignmentNote>> FindConflictingNotes(DateTime written, string text, string writer)
|
||||
{
|
||||
return await Queryable.Where(_context.AuctionAssignmentNotes, c => c.DateWritten == written && c.Text == text && c.Writer == writer).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<AuctionAssignmentNote> AddAsync(AuctionAssignmentNote auctionAssignmentNote)
|
||||
{
|
||||
var result = await _context.AuctionAssignmentNotes.AddAsync(auctionAssignmentNote);
|
||||
return result.Entity;
|
||||
}
|
||||
|
||||
public void Update(AuctionAssignmentNote auctionAssignmentNote)
|
||||
{
|
||||
_context.AuctionAssignmentNotes.Update(auctionAssignmentNote);
|
||||
}
|
||||
|
||||
public void Remove(AuctionAssignmentNote auctionAssignmentNote)
|
||||
{
|
||||
_context.AuctionAssignmentNotes.Remove(auctionAssignmentNote);
|
||||
}
|
||||
}
|
||||
}
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Extensions;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Results;
|
||||
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public class AuctionAssignmentRepository : BaseRepository, IAuctionAssignmentRepository
|
||||
{
|
||||
public AuctionAssignmentRepository(AppDbContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<PagedResult<AuctionAssignment>> ListAllAsync(int filterPage, int filterLimit)
|
||||
{
|
||||
var results = new PagedResult<AuctionAssignment>();
|
||||
var skip = (filterPage - 1) * filterLimit;
|
||||
|
||||
var temp = (from x in _context.AuctionAssignments
|
||||
select x).OrderByDescending(x => x.ID);
|
||||
|
||||
results.Total = temp.Count();
|
||||
results.Items = await temp.Skip(skip).Take(filterLimit).IncludeAll().ToListAsync();
|
||||
return results;
|
||||
}
|
||||
|
||||
public async Task<PagedResult<AuctionAssignment>> ListReadyForFloorPriceAsync()
|
||||
{
|
||||
var results = new PagedResult<AuctionAssignment>();
|
||||
|
||||
var temp = (from x in _context.AuctionAssignments
|
||||
where (x.FloorPrice ?? 0) == 0 && x.AutoIMS != null && x.AutoIMS.SoldDate == null &&
|
||||
(x.AutoIMS.StatedMileage ?? -1) > 1 && x.AutoIMS.ScheduledSaleDate != null &&
|
||||
x.AutoIMS.ScheduledSaleDate > DateTime.Now.Date &&
|
||||
x.RedeemedDate == null &&
|
||||
( (x.AutoIMS.ApprovedVehicleGrade ?? 0) > 0 || (x.AutoIMS.VehicleGrade ?? 0) > 0)
|
||||
select x).OrderByDescending(x => x.ID);
|
||||
|
||||
results.Items = await temp.IncludeAll().ToListAsync();
|
||||
results.Total = temp.Count();
|
||||
return results;
|
||||
}
|
||||
|
||||
public async Task<AuctionAssignment> FindByIdAsync(int id)
|
||||
{
|
||||
return await Queryable.Where(_context.AuctionAssignments, c => c.ID == id).IncludeAll().FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyCollection<AuctionAssignment>> FindListByIdsAsync(IReadOnlyCollection<int> idSet)
|
||||
{
|
||||
return await Queryable.Where(_context.AuctionAssignments, c => idSet.Contains(c.ID)).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyCollection<AuctionAssignment>> FindByRepoIdAsync(int repoId)
|
||||
{
|
||||
return await _context.AuctionAssignments.Where(auctionAssignment => auctionAssignment.RepoId == repoId).IncludeAll().ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<AuctionAssignment> FindByByAuctionCustomerNoAndVin(string auctionCustomerNo, string vin)
|
||||
{
|
||||
return await Queryable
|
||||
.Where(_context.AuctionAssignments, auctionAssignment =>
|
||||
auctionAssignment.AuctionCustomerNo == auctionCustomerNo &&
|
||||
auctionAssignment.CollateralVIN == vin &&
|
||||
auctionAssignment.IsActive == true).IncludeAll().FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<AuctionAssignment> AddAsync(AuctionAssignment auctionAssignment)
|
||||
{
|
||||
var result = await _context.AuctionAssignments.AddAsync(auctionAssignment);
|
||||
result.Entity.Auction = Queryable.Where(_context.Auctions, a => a.AuctionID == result.Entity.AuctionId)
|
||||
.FirstOrDefault();
|
||||
return result.Entity;
|
||||
}
|
||||
|
||||
public void Update(AuctionAssignment auctionAssignment)
|
||||
{
|
||||
_context.AuctionAssignments.Update(auctionAssignment);
|
||||
}
|
||||
|
||||
public void Remove(AuctionAssignment auctionAssignment)
|
||||
{
|
||||
_context.AuctionAssignments.Remove(auctionAssignment);
|
||||
}
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Results;
|
||||
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public class AuctionHouseRepository : BaseRepository, IAuctionHouseRepository
|
||||
{
|
||||
|
||||
public AuctionHouseRepository(AppDbContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<AuctionHouse>> ListAllAsync()
|
||||
{
|
||||
return await _context.Auctions.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task AddAsync(AuctionHouse auction)
|
||||
{
|
||||
await _context.Auctions.AddAsync(auction);
|
||||
}
|
||||
|
||||
public async Task<AuctionHouse> FindByIdAsync(string id)
|
||||
{
|
||||
return await Queryable.Where<AuctionHouse>(_context.Auctions, c => c.AuctionID == id).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public void Update(AuctionHouse auction)
|
||||
{
|
||||
_context.Auctions.Update(auction);
|
||||
}
|
||||
|
||||
public void Remove(AuctionHouse auction)
|
||||
{
|
||||
_context.Auctions.Remove(auction);
|
||||
}
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Results;
|
||||
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public class AuditRecordRepository : BaseRepository, IAuditRecordRepository
|
||||
{
|
||||
public AuditRecordRepository(AppDbContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<PagedResult<AuditRecord>> ListAllAsync(int filterPage, int filterLimit)
|
||||
{
|
||||
var results = new PagedResult<AuditRecord>();
|
||||
var skip = (filterPage - 1) * filterLimit;
|
||||
|
||||
var temp = Queryable.OrderByDescending<AuditRecord, int>((from x in _context.AuditRecords
|
||||
where x.DatePerformed > DateTime.Today.AddDays(-120)
|
||||
select x), x => x.ID);
|
||||
|
||||
results.Total = temp.Count();
|
||||
results.Items = await temp.Skip(skip).Take(filterLimit).ToListAsync();
|
||||
return results;
|
||||
}
|
||||
|
||||
public async Task AddAsync(AuditRecord auditRecord)
|
||||
{
|
||||
await _context.AuditRecords.AddAsync(auditRecord);
|
||||
}
|
||||
|
||||
public async Task<AuditRecord> FindByIdAsync(int id)
|
||||
{
|
||||
return await _context.AuditRecords.FindAsync(id);
|
||||
}
|
||||
|
||||
public void Update(AuditRecord auditRecord)
|
||||
{
|
||||
_context.AuditRecords.Update(auditRecord);
|
||||
}
|
||||
|
||||
public void Remove(AuditRecord auditRecord)
|
||||
{
|
||||
_context.AuditRecords.Remove(auditRecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
using LCU.Library.Internal.LcuClassPatterns.Crud.Repositories;
|
||||
using LCU.Library.Internal.RepoApiModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Batch
|
||||
{
|
||||
public interface IRepoSyncBatchRepository: ICrudRepository<RepoSyncBatch>
|
||||
{
|
||||
Task<IEnumerable<RepoSyncBatch>> FindAllByRunInfoIdAsync(int id);
|
||||
Task<RepoSyncBatch> FindUncompletedByAuditId(string auditItemKey);
|
||||
Task<RepoSyncBatch> FindByBatchIdAndAuditIdAsync(int batchId, string auditItemKey);
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
using LCU.Library.Internal.LcuClassPatterns.Crud.Repositories;
|
||||
using LCU.Library.Internal.RepoApiModels.Models;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Batch
|
||||
{
|
||||
public interface IRepoSyncRunInfoRepository: ICrudRepository<RepoSyncRunInfo>
|
||||
{
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
||||
using LCU.Library.Internal.LcuClassPatterns.Crud.Repositories;
|
||||
using LCU.Library.Internal.RepoApiModels.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Batch;
|
||||
|
||||
public class RepoSyncBatchRepository : CrudRepository<RepoSyncBatch>, IRepoSyncBatchRepository
|
||||
{
|
||||
private readonly AppDbContext _context;
|
||||
public RepoSyncBatchRepository(AppDbContext context) : base(context) {
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<RepoSyncBatch>> FindAllByRunInfoIdAsync(int id)
|
||||
{
|
||||
return await _context.RepoSyncBatch.Where(repoSyncBatch => repoSyncBatch.RepoSyncRunInfoId == id).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<RepoSyncBatch> FindByIdAsync(int id)
|
||||
{
|
||||
return await _context.RepoSyncBatch.Where(repoSyncBatch => repoSyncBatch.RepoSyncBatchId == id).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<RepoSyncBatch> FindUncompletedByAuditId(string auditItemKey) =>
|
||||
await _context.RepoSyncBatch
|
||||
.Where(repoSyncBatch => repoSyncBatch.AuditItemKey == auditItemKey && repoSyncBatch.RepoSyncCompletionDateTime == null)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
public async Task<RepoSyncBatch> FindByBatchIdAndAuditIdAsync(int batchId, string auditItemKey) =>
|
||||
await _context.RepoSyncBatch
|
||||
.Where(repoSyncBatch => repoSyncBatch.RepoSyncBatchId == batchId && repoSyncBatch.AuditItemKey == auditItemKey)
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
||||
using LCU.Library.Internal.LcuClassPatterns.Crud.Repositories;
|
||||
using LCU.Library.Internal.RepoApiModels.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Batch;
|
||||
|
||||
public class RepoSyncRunInfoRepository : CrudRepository<RepoSyncRunInfo>, IRepoSyncRunInfoRepository
|
||||
{
|
||||
private readonly AppDbContext _context;
|
||||
public RepoSyncRunInfoRepository(AppDbContext context) : base(context) {
|
||||
_context = context;
|
||||
}
|
||||
}
|
||||
+46
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
+266
@@ -0,0 +1,266 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.API.Internal.RepoApi.Repos.Exceptions;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Serilog;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public class EventAlertRepository : BaseRepository, IEventAlertRepository
|
||||
{
|
||||
private const string RepoStatus = "REPO";
|
||||
private const string O4RStatus = "O4R";
|
||||
private const int ClosedAccountCutoffDays = 90;
|
||||
|
||||
private static List<string> _nonRepeatingAlerts = new List<string>
|
||||
{
|
||||
"Credit Adjustment Received",
|
||||
"Debit Adjustment Received",
|
||||
"Notice of Plan to Sell Not Found",
|
||||
"Notice of Repossession Not Found",
|
||||
"RTC Letter Not Found"
|
||||
};
|
||||
|
||||
public EventAlertRepository(AppDbContext context) : base(context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<EventAlert>> ListAllAsync()
|
||||
{
|
||||
return await _context.EventAlerts.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<EventAlert>> ListUnreadAsync()
|
||||
{
|
||||
var result = from alert in _context.EventAlerts
|
||||
join repo in _context.RepoAccounts
|
||||
on alert.AccountNo equals repo.AccountNo
|
||||
join activeStatus in _context.RepoManualStatuses
|
||||
on repo.Status equals activeStatus.Description
|
||||
where activeStatus.WatchForStatusChanges && alert.DateMarkedRead == null
|
||||
select alert;
|
||||
|
||||
return await result.Distinct().ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<EventAlert>> ListWithinDateRangeAsync(DateTime start, DateTime end)
|
||||
{
|
||||
return await _context.EventAlerts.Where(e => e.DateAdded >= start && e.DateAdded <= end).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<EventAlert>> ListRepoNoAuctionAsync()
|
||||
{
|
||||
var closedDateCutoff = DateTime.Today.Subtract(TimeSpan.FromDays(ClosedAccountCutoffDays));
|
||||
var accountsInRepo = (
|
||||
from repo in _context.RepoAccounts
|
||||
where repo.Status.Equals(RepoStatus) && (repo.DateClosed == null || repo.DateClosed > closedDateCutoff)
|
||||
select repo);
|
||||
|
||||
var accountsInRepoWithAuction = (
|
||||
from repo in accountsInRepo
|
||||
join auctionAssignment in _context.AuctionAssignments
|
||||
on repo.RepoId equals auctionAssignment.RepoId
|
||||
where auctionAssignment.IsActive == true
|
||||
select repo);
|
||||
|
||||
var accountsNoAuction = await accountsInRepo.Except(accountsInRepoWithAuction).ToListAsync();
|
||||
|
||||
return accountsNoAuction.Select(repo => new EventAlert()
|
||||
{
|
||||
AccountNo = repo.AccountNo,
|
||||
RepoId = repo.RepoId,
|
||||
Message = "Repo No Auction"
|
||||
}).Distinct();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<EventAlert>> ListRepoNoCompanyAsync()
|
||||
{
|
||||
return await ListStatusNoCompanyAsync(RepoStatus);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<EventAlert>> ListO4rNoCompanyAsync()
|
||||
{
|
||||
return await ListStatusNoCompanyAsync(O4RStatus);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<EventAlert>> ListStatusNoCompanyAsync(string status)
|
||||
{
|
||||
var closedDateCutoff = DateTime.Today.Subtract(TimeSpan.FromDays(ClosedAccountCutoffDays));
|
||||
var result = from repo in _context.RepoAccounts
|
||||
from collateral in _context.Collaterals.Where(c => c.RepoId == repo.RepoId)
|
||||
from repoCompanySelection in _context.RepoCompanySelections.Where(x => x.CollateralId == collateral.CollateralId).DefaultIfEmpty()
|
||||
where (repoCompanySelection == null || repoCompanySelection.RepoCompanyId == null) && repo.Status.Equals(status) && (repo.DateClosed == null || repo.DateClosed > closedDateCutoff)
|
||||
select new EventAlert
|
||||
{
|
||||
AccountNo = repo.AccountNo,
|
||||
RepoId = repo.RepoId,
|
||||
Message = status + " No Repo Company"
|
||||
};
|
||||
|
||||
var temp = await result.Distinct().ToListAsync();
|
||||
return temp;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<EventAlert>> ListReadyForRetitleAsync()
|
||||
{
|
||||
var result = from collateral in _context.Collaterals
|
||||
join repo in _context.RepoAccounts
|
||||
on collateral.RepoId equals repo.RepoId
|
||||
join auctionAssignmentToCollateral in _context.AuctionAssignmentToCollaterals
|
||||
on collateral.CollateralId equals auctionAssignmentToCollateral.CollateralId
|
||||
join auctionAssignment in _context.AuctionAssignments
|
||||
on auctionAssignmentToCollateral.AuctionAssignmentId equals auctionAssignment.ID
|
||||
from data in Queryable.Where<ImsAutoFileData>(_context.ImsAutoFileData, ims => auctionAssignment.ID == ims.AuctionAssignmentId ||
|
||||
(repo.RepoId == ims.RepoId && auctionAssignment.CollateralVIN == ims.VIN))
|
||||
where collateral.RetitledInLandmarkName == null && repo.Status.Equals(RepoStatus) && auctionAssignment.IsActive && repo.RedemptionExpiredDate < DateTime.Today
|
||||
select new EventAlert
|
||||
{
|
||||
AccountNo = repo.AccountNo,
|
||||
RepoId = repo.RepoId,
|
||||
Message = "Ready For Retitle"
|
||||
};
|
||||
|
||||
return await result.Distinct().ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<EventAlert>> ListFloorUpdateFailedAsync()
|
||||
{
|
||||
var result = from autoFileData in _context.ImsAutoFileData
|
||||
join repo in _context.RepoAccounts
|
||||
on autoFileData.RepoId equals repo.RepoId
|
||||
join collateral in _context.Collaterals
|
||||
on repo.RepoId equals collateral.RepoId
|
||||
join auctionAssignmentToCollateral in _context.AuctionAssignmentToCollaterals
|
||||
on collateral.CollateralId equals auctionAssignmentToCollateral.CollateralId
|
||||
join auctionAssignment in _context.AuctionAssignments
|
||||
on auctionAssignmentToCollateral.AuctionAssignmentId equals auctionAssignment.ID
|
||||
where ((auctionAssignment.HoldStatus ?? 0) == 0 || (auctionAssignment.HoldUntil ?? DateTime.Now) <= DateTime.Now) &&
|
||||
auctionAssignment.RedeemedDate == null &&
|
||||
autoFileData.SoldDate == null &&
|
||||
(auctionAssignment.FloorPriceResponseCode != null && auctionAssignment.FloorPriceResponseCode != 1)
|
||||
select new EventAlert
|
||||
{
|
||||
AccountNo = repo.AccountNo,
|
||||
RepoId = repo.RepoId,
|
||||
Message = "Floor Update Failed"
|
||||
};
|
||||
|
||||
return await result.Distinct().ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<EventAlert>> ListFloorNeedsSettingAsync()
|
||||
{
|
||||
var result = from data in _context.ImsAutoFileData
|
||||
join repo in _context.RepoAccounts
|
||||
on data.RepoId equals repo.RepoId
|
||||
join collateral in _context.Collaterals
|
||||
on repo.RepoId equals collateral.RepoId
|
||||
join auctionAssignmentToCollateral in _context.AuctionAssignmentToCollaterals
|
||||
on collateral.CollateralId equals auctionAssignmentToCollateral.CollateralId
|
||||
join auctionAssignment in _context.AuctionAssignments
|
||||
on auctionAssignmentToCollateral.AuctionAssignmentId equals auctionAssignment.ID
|
||||
where (auctionAssignment.FloorPrice ?? 0) == 0 &&
|
||||
((auctionAssignment.HoldStatus ?? 0) == 0 || (auctionAssignment.HoldUntil ?? DateTime.Now) <= DateTime.Now) &&
|
||||
auctionAssignment.RedeemedDate == null &&
|
||||
data.SoldDate == null &&
|
||||
data.ScheduledSaleDate != null &&
|
||||
data.ScheduledSaleDate < DateTime.Now.AddDays(3) &&
|
||||
repo.DateClosed == null
|
||||
select new EventAlert
|
||||
{
|
||||
AccountNo = repo.AccountNo,
|
||||
RepoId = repo.RepoId,
|
||||
Message = "Floor Set Required"
|
||||
};
|
||||
|
||||
return await result.Distinct().ToListAsync();
|
||||
}
|
||||
|
||||
public async Task AddAsync(EventAlert eventAlert)
|
||||
{
|
||||
if (eventAlert.SubMessage != null && eventAlert.SubMessage.Length > 499)
|
||||
{
|
||||
eventAlert.SubMessage = eventAlert.SubMessage.Substring(0, 499);
|
||||
}
|
||||
|
||||
if (!IsDuplicateAlert(eventAlert))
|
||||
{
|
||||
await _context.EventAlerts.AddAsync(eventAlert);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new DuplicateResourceException("EventAlert");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<EventAlert>> AddRangeAsync(IEnumerable<EventAlert> eventAlerts)
|
||||
{
|
||||
List<EventAlert> filteredEventAlerts = new List<EventAlert>();
|
||||
|
||||
foreach (EventAlert eventAlert in eventAlerts)
|
||||
{
|
||||
if (eventAlert.SubMessage != null && eventAlert.SubMessage.Length > 499)
|
||||
{
|
||||
eventAlert.SubMessage = eventAlert.SubMessage.Substring(0, 499);
|
||||
}
|
||||
|
||||
if (!IsDuplicateAlert(eventAlert))
|
||||
{
|
||||
filteredEventAlerts.Add(eventAlert);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Debug($"EventAlertRepository: Valid Alert Already Exists eventAlert: {@eventAlert}." +
|
||||
$" Will Continue without adding this to Event Alerts Context.", eventAlerts, eventAlert
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
await _context.EventAlerts.AddRangeAsync(filteredEventAlerts);
|
||||
return filteredEventAlerts;
|
||||
}
|
||||
|
||||
public bool IsDuplicateAlert(EventAlert eventAlert)
|
||||
{
|
||||
var duplicateAlerts = (
|
||||
from alert in _context.EventAlerts
|
||||
where alert.AccountNo == eventAlert.AccountNo &&
|
||||
alert.Message == eventAlert.Message &&
|
||||
(
|
||||
alert.DateMarkedRead == null ||
|
||||
alert.DateMarkedRead > DateTime.Now.AddHours(-24) ||
|
||||
_nonRepeatingAlerts.Contains(alert.Message)
|
||||
)
|
||||
select alert
|
||||
).ToList();
|
||||
|
||||
return (duplicateAlerts.Any());
|
||||
}
|
||||
|
||||
public async Task<EventAlert> FindByIdAsync(int id)
|
||||
{
|
||||
return await _context.EventAlerts.FindAsync(id);
|
||||
}
|
||||
|
||||
public void Update(EventAlert category)
|
||||
{
|
||||
_context.EventAlerts.Update(category);
|
||||
}
|
||||
|
||||
public void Remove(EventAlert category)
|
||||
{
|
||||
_context.EventAlerts.Remove(category);
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<EventAlert>> ListUnreadByAccountNoAsync(string accountNo)
|
||||
{
|
||||
var results = _context.EventAlerts.Where(x => x.AccountNo == accountNo && x.DateMarkedRead == null);
|
||||
return await results.ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
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 ExternalUserRepository : BaseRepository, IExternalUserRepository
|
||||
{
|
||||
public ExternalUserRepository(AppDbContext context) : base(context) { }
|
||||
|
||||
public async Task<IReadOnlyCollection<ExternalUser>> ListAsync()
|
||||
{
|
||||
var result = await _context.ExternalUsers.AsNoTracking().ToListAsync();
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<ExternalUser> FindByReferenceIdAsync(int referenceId)
|
||||
{
|
||||
return await _context.ExternalUsers.AsNoTracking().Where(user => user.ReferenceId == referenceId).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task SynchronizeSet(IReadOnlyCollection<ExternalUser> externalUsers)
|
||||
{
|
||||
foreach (var user in externalUsers)
|
||||
{
|
||||
var existing = await FindByReferenceIdAsync(user.ReferenceId);
|
||||
if (existing != null)
|
||||
{
|
||||
user.Id = existing.Id;
|
||||
_context.Entry(user).State = EntityState.Modified;
|
||||
_context.ExternalUsers.Update(user);
|
||||
}
|
||||
else
|
||||
{
|
||||
await _context.ExternalUsers.AddAsync(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Results;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public interface IAuctionAssignmentNoteRepository
|
||||
{
|
||||
Task<PagedResult<AuctionAssignmentNote>> ListAllAsync(int filterPage, int filterLimit);
|
||||
Task<AuctionAssignmentNote> FindByIdAsync(int id);
|
||||
Task<IEnumerable<AuctionAssignmentNote>> FindConflictingNotes(DateTime written, string text, string writer);
|
||||
Task<AuctionAssignmentNote> AddAsync(AuctionAssignmentNote auctionAssignmentNote);
|
||||
void Update(AuctionAssignmentNote auctionAssignmentNote);
|
||||
void Remove(AuctionAssignmentNote auctionAssignmentNote);
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Results;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public interface IAuctionAssignmentRepository
|
||||
{
|
||||
Task<PagedResult<AuctionAssignment>> ListAllAsync(int filterPage, int filterLimit);
|
||||
Task<PagedResult<AuctionAssignment>> ListReadyForFloorPriceAsync();
|
||||
Task<AuctionAssignment> FindByIdAsync(int id);
|
||||
Task<IReadOnlyCollection<AuctionAssignment>> FindByRepoIdAsync(int repoId);
|
||||
Task<AuctionAssignment> FindByByAuctionCustomerNoAndVin(string auctionCustomerNo, string vin);
|
||||
Task<AuctionAssignment> AddAsync(AuctionAssignment auctionAssignment);
|
||||
void Update(AuctionAssignment auctionAssignment);
|
||||
void Remove(AuctionAssignment auctionAssignment);
|
||||
Task<IReadOnlyCollection<AuctionAssignment>> FindListByIdsAsync(IReadOnlyCollection<int> idSet);
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public interface IAuctionHouseRepository
|
||||
{
|
||||
Task<IEnumerable<AuctionHouse>> ListAllAsync();
|
||||
Task AddAsync(AuctionHouse assignment);
|
||||
Task<AuctionHouse> FindByIdAsync(string id);
|
||||
void Update(AuctionHouse assignment);
|
||||
void Remove(AuctionHouse assignment);
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
using System.Threading.Tasks;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Results;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public interface IAuditRecordRepository
|
||||
{
|
||||
Task<PagedResult<AuditRecord>> ListAllAsync(int filterPage, int filterLimit);
|
||||
Task AddAsync(AuditRecord auditRecord);
|
||||
Task<AuditRecord> FindByIdAsync(int id);
|
||||
void Update(AuditRecord auditRecord);
|
||||
void Remove(AuditRecord auditRecord);
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public interface ICollateralRepository
|
||||
{
|
||||
Task<IEnumerable<Collateral>> ListAllAsync();
|
||||
Task<Collateral> AddAsync(Collateral collateral);
|
||||
Task<Collateral> FindByIdAsync(int id);
|
||||
Task<IEnumerable<Collateral>> FindByRepoIdAsync(int repoId);
|
||||
void Update(Collateral collateral);
|
||||
void Remove(Collateral collateral);
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public interface IEventAlertRepository
|
||||
{
|
||||
Task<IEnumerable<EventAlert>> ListAllAsync();
|
||||
Task<IEnumerable<EventAlert>> ListUnreadAsync();
|
||||
Task<IEnumerable<EventAlert>> ListWithinDateRangeAsync(DateTime start, DateTime end);
|
||||
Task<IEnumerable<EventAlert>> ListRepoNoAuctionAsync();
|
||||
Task<IEnumerable<EventAlert>> ListRepoNoCompanyAsync();
|
||||
Task<IEnumerable<EventAlert>> ListO4rNoCompanyAsync();
|
||||
Task<IEnumerable<EventAlert>> ListReadyForRetitleAsync();
|
||||
Task<IEnumerable<EventAlert>> ListFloorUpdateFailedAsync();
|
||||
Task<IEnumerable<EventAlert>> ListFloorNeedsSettingAsync();
|
||||
Task<IEnumerable<EventAlert>> ListUnreadByAccountNoAsync(string accountNo);
|
||||
Task AddAsync(EventAlert eventAlert);
|
||||
Task<IEnumerable<EventAlert>> AddRangeAsync(IEnumerable<EventAlert> eventAlerts);
|
||||
Task<EventAlert> FindByIdAsync(int id);
|
||||
void Update(EventAlert eventAlert);
|
||||
void Remove(EventAlert eventAlert);
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public interface IExternalUserRepository
|
||||
{
|
||||
Task<IReadOnlyCollection<ExternalUser>> ListAsync();
|
||||
Task<ExternalUser> FindByReferenceIdAsync(int referenceId);
|
||||
Task SynchronizeSet(IReadOnlyCollection<ExternalUser> externalUsers);
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public interface IImsAutoFileDataRepository
|
||||
{
|
||||
Task<IEnumerable<ImsAutoFileData>> ListAllAsync();
|
||||
Task AddAsync(ImsAutoFileData assignment);
|
||||
Task<ImsAutoFileData> FindByIdAsync(string vin, int repoId);
|
||||
Task<ImsAutoFileData> FindByAuctionAssignmentIdAsync(int auctionAssignmentId);
|
||||
Task<ImsAutoFileData> GetNonConformingImsFileRecord(string vin, string auctionCustomerNo);
|
||||
void Update(ImsAutoFileData autoImsAutoFileData);
|
||||
void Remove(ImsAutoFileData autoImsAutoFileData);
|
||||
Task<IReadOnlyCollection<ImsAutoFileData>> GetImsSoldRecordsForPeriod(DateTime lowDateTime, DateTime highDateTime);
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public interface ILetterRepository
|
||||
{
|
||||
Task<IEnumerable<Letter>> ListAsync();
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public interface IProcessingReceiptRepository
|
||||
{
|
||||
Task<IReadOnlyCollection<ProcessingReceipt>> FindReceiptsAsync(string accountNo,
|
||||
string accountId = "", string caseId = "");
|
||||
Task<IReadOnlyCollection<ProcessingReceipt>> GetReceiptsByAccountNoAsync(string accountNo);
|
||||
Task<IReadOnlyCollection<ProcessingReceipt>> GetRetryListAsync();
|
||||
Task AddOrUpdateAsync(ProcessingReceipt receipt);
|
||||
Task SaveAllAsync(IReadOnlyCollection<ProcessingReceipt> receipts);
|
||||
bool IsDuplicateReceipt(ProcessingReceipt newReceipt);
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public interface IRefundStatusRepository
|
||||
{
|
||||
Task<IReadOnlyCollection<RefundStatus>> ListAsync();
|
||||
Task<RefundStatus> FindByRepoIdAsync(int repoId);
|
||||
Task<RefundStatus> AddAsync(RefundStatus refundStatus);
|
||||
void Update(RefundStatus refundStatus);
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Producer;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Results;
|
||||
using LCU.Library.Internal.RepoApiModels.Models.Requests;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public interface IRepoAccountRepository
|
||||
{
|
||||
Task<PagedResult<RepoAccount>> ListAsync(List<int?> filterRepoIdList, int filterPage, int filterLimit, string status = null, string auctionHouseId = null, int? repoCompanyId = null, bool? onlyOpenAccounts = null);
|
||||
Task<IReadOnlyCollection<RepoAccount>> ListByAuctionVinAsync(string unformattedVin);
|
||||
Task<IReadOnlyCollection<RepoAccount>> FindByCurrentStatus(string currentStatus);
|
||||
Task<IReadOnlyCollection<RepoAccount>> FindByStatusChangeInPeriod(string status, DateTime lowDateTime, DateTime highDateTime, string previousStatus = null);
|
||||
Task<RepoAccount> AddAsync(RepoAccount repoAccount);
|
||||
Task<RepoAccount> FindByIdAsync(int id);
|
||||
Task<IReadOnlyCollection<RepoAccount>> FindByRepoIdAsync(List<string> filterRepoIdList);
|
||||
Task<IReadOnlyCollection<RepoAccount>> SearchRepoAccounts(string searchPhrase, int maxLimit);
|
||||
Task<IReadOnlyCollection<RepoAccount>> FindByAccountNoAsync(string accountNo);
|
||||
Task<RepoAccount> FindByAuctionAssignmentIdAsync(int id);
|
||||
Task<IReadOnlyCollection<RepoAccount>> GetCurrentAccountsOnHoldAtAuction();
|
||||
void Update(RepoAccount eventAlert);
|
||||
void Remove(RepoAccount eventAlert);
|
||||
Task<IReadOnlyCollection<RepoAccountProcessingRequest>> GetItemsForProcessing(IReadOnlyCollection<string> watchStatusList);
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public interface IRepoCompanyRepository
|
||||
{
|
||||
Task<IReadOnlyCollection<RepoCompany>> ListAsync();
|
||||
Task<RepoCompany> AddAsync(RepoCompany repoCompany);
|
||||
Task<RepoCompany> FindByIdAsync(int id);
|
||||
void Update(RepoCompany repoCompany);
|
||||
void Remove(RepoCompany repoCompany);
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public interface IRepoCompanySelectionRepository
|
||||
{
|
||||
Task<IEnumerable<RepoCompanySelection>> ListAllAsync();
|
||||
Task AddAsync(RepoCompanySelection repoCompanySelection);
|
||||
Task<RepoCompanySelection> FindByIdAsync(int id);
|
||||
Task<IEnumerable<RepoCompanySelection>> FindByCollateralIdAsync(int collateralId);
|
||||
void Update(RepoCompanySelection repoCompanySelection);
|
||||
void Remove(RepoCompanySelection repoCompanySelection);
|
||||
|
||||
void SaveRange(IList<RepoCompanySelection> repoCompanySelections);
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public interface IRepoManualStatusRepository
|
||||
{
|
||||
Task<IReadOnlyCollection<RepoManualStatus>> ListAllAsync();
|
||||
Task<IReadOnlyCollection<string>> ListWatchStatusesAsync();
|
||||
Task AddAsync(RepoManualStatus repoManualStatus);
|
||||
Task<RepoManualStatus> FindByIdAsync(int id);
|
||||
void Update(RepoManualStatus repoManualStatus);
|
||||
void Remove(RepoManualStatus repoManualStatus);
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public interface IRepoStatusChangeRepository
|
||||
{
|
||||
Task<IEnumerable<RepoStatusChange>> ListAsync();
|
||||
Task<IEnumerable<RepoStatusChange>> ListForAccountAsync(int repoAccountId);
|
||||
Task<RepoStatusChange> AddAsync(RepoStatusChange statusChange);
|
||||
Task<RepoStatusChange> FindByIdAsync(int id);
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public interface ISavedLocationRepository
|
||||
{
|
||||
Task<IEnumerable<SavedLocation>> ListAsync();
|
||||
Task<SavedLocation> AddAsync(SavedLocation savedLocation);
|
||||
Task<SavedLocation> FindByIdAsync(int id);
|
||||
void Update(SavedLocation savedLocation);
|
||||
void Remove(SavedLocation savedLocation);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public interface IUnitOfWork
|
||||
{
|
||||
Task CompleteAsync();
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public interface IVehicleFloorPricingParametersRepository
|
||||
{
|
||||
Task<IEnumerable<VehicleFloorPricingParameters>> ListAllAsync();
|
||||
Task AddAsync(VehicleFloorPricingParameters Collateral);
|
||||
Task<VehicleFloorPricingParameters> FindByIdAsync(int id);
|
||||
void Update(VehicleFloorPricingParameters Collateral);
|
||||
void Remove(VehicleFloorPricingParameters Collateral);
|
||||
}
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
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 ImsAutoFileDataRepository : BaseRepository, IImsAutoFileDataRepository
|
||||
{
|
||||
public ImsAutoFileDataRepository(AppDbContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<ImsAutoFileData>> ListAllAsync()
|
||||
{
|
||||
return await _context.ImsAutoFileData.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task AddAsync(ImsAutoFileData assignment)
|
||||
{
|
||||
await _context.ImsAutoFileData.AddAsync(assignment);
|
||||
}
|
||||
|
||||
public async Task<ImsAutoFileData> FindByIdAsync(string vin, int repoId)
|
||||
{
|
||||
return await _context.ImsAutoFileData.Where(x => x.VIN == vin && x.RepoId == repoId).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<ImsAutoFileData> FindByAuctionAssignmentIdAsync(int auctionAssignmentId)
|
||||
{
|
||||
return await _context.ImsAutoFileData.Where(x => x.AuctionAssignmentId == auctionAssignmentId)
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<ImsAutoFileData> GetNonConformingImsFileRecord(string vin, string auctionCustomerNo)
|
||||
{
|
||||
ImsAutoFileData imsAutoFile = null;
|
||||
|
||||
// Allow for vehicle brought back to auction after sale. it happens!
|
||||
DateTime withinThirtyDays = DateTime.Now.AddDays(-30);
|
||||
imsAutoFile = await _context.ImsAutoFileData.Where(x =>
|
||||
(x.VIN.Trim() == vin && x.AuctionCustomerNo == auctionCustomerNo
|
||||
&& (x.SoldDate == null || x.SoldDate >= withinThirtyDays))).FirstOrDefaultAsync();
|
||||
|
||||
return imsAutoFile;
|
||||
}
|
||||
|
||||
public void Update(ImsAutoFileData autoImsAutoFileData)
|
||||
{
|
||||
_context.ImsAutoFileData.Update(autoImsAutoFileData);
|
||||
}
|
||||
|
||||
public void Remove(ImsAutoFileData autoImsAutoFileData)
|
||||
{
|
||||
_context.ImsAutoFileData.Remove(autoImsAutoFileData);
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyCollection<ImsAutoFileData>> GetImsSoldRecordsForPeriod(DateTime lowDateTime,
|
||||
DateTime highDateTime)
|
||||
{
|
||||
return await _context.ImsAutoFileData
|
||||
.Where(x => x.SoldDate != null && x.SoldDate >= lowDateTime && x.SoldDate <= highDateTime)
|
||||
.ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
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 LetterRepository : BaseRepository, ILetterRepository
|
||||
{
|
||||
public LetterRepository(AppDbContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Letter>> ListAsync()
|
||||
{
|
||||
return await _context.Letters.ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Producer;
|
||||
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public class ProcessingReceiptRepository : BaseRepository, IProcessingReceiptRepository
|
||||
{
|
||||
private readonly IReadOnlyCollection<RepoProcessingResult> _retryOutcomes = new List<RepoProcessingResult>()
|
||||
{
|
||||
RepoProcessingResult.Error, RepoProcessingResult.MissingRequirement
|
||||
};
|
||||
|
||||
public ProcessingReceiptRepository(AppDbContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyCollection<ProcessingReceipt>> FindReceiptsAsync(string accountNo,
|
||||
string accountId = "", string caseId = "")
|
||||
{
|
||||
return await _context.ProcessingReceipts.Where(receipt => receipt.AccountNo == accountNo
|
||||
&& receipt.AccountId == accountId &&
|
||||
receipt.CaseId == caseId).AsNoTracking().ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyCollection<ProcessingReceipt>> GetReceiptsByAccountNoAsync(string accountNo)
|
||||
{
|
||||
return await _context.ProcessingReceipts.Where(receipt => receipt.AccountNo == accountNo).AsNoTracking().ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyCollection<ProcessingReceipt>> GetRetryListAsync()
|
||||
{
|
||||
return await _context.ProcessingReceipts.Where(receipt => _retryOutcomes.Contains(receipt.Outcome))
|
||||
.AsNoTracking().ToListAsync();
|
||||
}
|
||||
|
||||
public async Task AddOrUpdateAsync(ProcessingReceipt receipt)
|
||||
{
|
||||
if (receipt.Message != null && receipt.Message.Length > 124)
|
||||
{
|
||||
receipt.Message = receipt.Message.Substring(0, 124);
|
||||
}
|
||||
|
||||
if (receipt.QueuedBy != null && receipt.QueuedBy.Length > 39)
|
||||
{
|
||||
receipt.QueuedBy = receipt.QueuedBy.Substring(0, 39);
|
||||
}
|
||||
|
||||
if (!IsDuplicateReceipt(receipt))
|
||||
{
|
||||
await _context.ProcessingReceipts.AddAsync(receipt);
|
||||
}
|
||||
else
|
||||
{
|
||||
_context.Entry(receipt).State = EntityState.Modified;
|
||||
_context.ProcessingReceipts.Update(receipt);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SaveAllAsync(IReadOnlyCollection<ProcessingReceipt> receipts)
|
||||
{
|
||||
var saveAllReceipts = receipts.Select(AddOrUpdateAsync).ToList();
|
||||
await Task.WhenAll(saveAllReceipts);
|
||||
}
|
||||
|
||||
public bool IsDuplicateReceipt(ProcessingReceipt newReceipt)
|
||||
{
|
||||
var duplicateReceipts = (
|
||||
from existingReceipt in _context.ProcessingReceipts
|
||||
where existingReceipt.AccountNo == newReceipt.AccountNo
|
||||
&& existingReceipt.AccountId == newReceipt.AccountId
|
||||
&& existingReceipt.CaseId == newReceipt.CaseId
|
||||
select existingReceipt
|
||||
).AsNoTracking().ToList();
|
||||
|
||||
return (duplicateReceipts.Count() != 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
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 RefundStatusRepository : BaseRepository, IRefundStatusRepository
|
||||
{
|
||||
public RefundStatusRepository(AppDbContext context) : base(context) {}
|
||||
|
||||
public async Task<IReadOnlyCollection<RefundStatus>> ListAsync()
|
||||
{
|
||||
return await _context.RefundStatuses.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<RefundStatus> FindByRepoIdAsync(int repoId)
|
||||
{
|
||||
return await _context.RefundStatuses.Where(refundStatus => refundStatus.RepoId == repoId).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<RefundStatus> AddAsync(RefundStatus refundStatus)
|
||||
{
|
||||
var result = await _context.RefundStatuses.AddAsync(refundStatus);
|
||||
return result.Entity;
|
||||
}
|
||||
|
||||
public void Update(RefundStatus refundStatus)
|
||||
{
|
||||
_context.RefundStatuses.Update(refundStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
+237
@@ -0,0 +1,237 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.API.Internal.RepoApi.Repos.Exceptions;
|
||||
using LCU.API.Internal.RepoApi.Repos.Extensions;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Producer;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Results;
|
||||
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
||||
using LCU.Library.Internal.RepoApiModels.Models.Requests;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Serilog;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public class RepoAccountRepository : BaseRepository, IRepoAccountRepository
|
||||
{
|
||||
public RepoAccountRepository(AppDbContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<PagedResult<RepoAccount>> ListAsync(
|
||||
List<int?> filterAccountNoList,
|
||||
int filterPage,
|
||||
int filterLimit,
|
||||
string status,
|
||||
string auctionHouseId,
|
||||
int? repoCompanyId,
|
||||
bool? onlyOpenAccounts)
|
||||
{
|
||||
var results = new PagedResult<RepoAccount>();
|
||||
var skip = (filterPage - 1) * filterLimit;
|
||||
|
||||
|
||||
var accounts = _context.RepoAccounts.Select(account => account);
|
||||
|
||||
// Filter By Repo Ids?
|
||||
if (filterAccountNoList != null && filterAccountNoList.Any())
|
||||
{
|
||||
accounts = accounts.Where(account => filterAccountNoList.Contains(account.RepoId));
|
||||
}
|
||||
|
||||
// Filter By Status?
|
||||
if (!string.IsNullOrEmpty(status))
|
||||
{
|
||||
accounts = accounts.Where(account => account.Status.ToLower() == status.ToLower());
|
||||
}
|
||||
|
||||
// Filter By Auction House?
|
||||
if (!string.IsNullOrEmpty(auctionHouseId))
|
||||
{
|
||||
accounts = accounts.Join(_context.AuctionAssignments.AsEnumerable(), account => account.RepoId, auction => auction.RepoId,
|
||||
(account, auction) => new { AuctionAssignment = auction, RepoAccount = account })
|
||||
.Where(joined => joined.AuctionAssignment.IsActive && joined.AuctionAssignment.AuctionId == auctionHouseId)
|
||||
.Select(result => result.RepoAccount);
|
||||
}
|
||||
|
||||
// Filter By Repo Company?
|
||||
if (repoCompanyId != null)
|
||||
{
|
||||
accounts = accounts.Join(_context.Collaterals.AsEnumerable(), account => account.RepoId, collateral => collateral.RepoId,
|
||||
(account, collateral) => new { RepoAccount = account, Collateral = collateral })
|
||||
.Join(_context.RepoCompanySelections.AsEnumerable(), accountCollateral => accountCollateral.Collateral.CollateralId,
|
||||
repocompany => repocompany.CollateralId,
|
||||
(accountCollateral, repocompany) => new { accountCollateral.RepoAccount, accountCollateral.Collateral, RepoCompany = repocompany })
|
||||
.Where(joined => joined.RepoCompany.RepoCompanyId == repoCompanyId)
|
||||
.Select(result => result.RepoAccount);
|
||||
}
|
||||
|
||||
// Filter Out Closed Accounts?
|
||||
if (onlyOpenAccounts == true)
|
||||
{
|
||||
accounts = accounts.Where(account => !account.DateClosed.HasValue);
|
||||
}
|
||||
|
||||
accounts = accounts.Distinct();
|
||||
|
||||
results.Total = accounts.Count();
|
||||
results.Items = await accounts.Skip(skip).Take(filterLimit).IncludeAll().ToListAsync();
|
||||
return results;
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyCollection<RepoAccount>> FindByRepoIdAsync(List<string> filterRepoIdList)
|
||||
{
|
||||
var accounts = await Queryable.OrderByDescending<RepoAccount, string>((from account in _context.RepoAccounts
|
||||
where filterRepoIdList.Count == 0 || filterRepoIdList.Contains(account.RepoId.ToString())
|
||||
select account), x => x.AccountNo).IncludeAll().ToListAsync();
|
||||
|
||||
return accounts;
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyCollection<RepoAccount>> ListByAuctionVinAsync(string unformattedVin)
|
||||
{
|
||||
string vin = unformattedVin.Trim().ToUpper();
|
||||
|
||||
List<RepoAccount> repos = await (from account in _context.RepoAccounts
|
||||
join collateral in _context.Collaterals on account.RepoId equals collateral.RepoId
|
||||
where GetFormattedVIN(collateral.Vin) == vin
|
||||
select account).ToListAsync();
|
||||
|
||||
return repos;
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyCollection<RepoAccount>> FindByStatusChangeInPeriod(
|
||||
string status,
|
||||
DateTime lowDateTime,
|
||||
DateTime highDateTime,
|
||||
string previousStatus = null)
|
||||
{
|
||||
var repos = await (
|
||||
from account in _context.RepoAccounts
|
||||
join statusChange in _context.RepoStatusChanges on account.RepoId equals statusChange.RepoId
|
||||
where
|
||||
string.Equals(account.Status, status, StringComparison.CurrentCultureIgnoreCase) &&
|
||||
(
|
||||
previousStatus != null
|
||||
? string.Equals(statusChange.StatusFrom, previousStatus, StringComparison.CurrentCultureIgnoreCase)
|
||||
: true
|
||||
) &&
|
||||
string.Equals(statusChange.StatusTo, status, StringComparison.CurrentCultureIgnoreCase) &&
|
||||
statusChange.ChangedDate >= lowDateTime && statusChange.ChangedDate <= highDateTime
|
||||
select account)
|
||||
.Distinct()
|
||||
.IncludeAll()
|
||||
.ToListAsync();
|
||||
|
||||
return repos;
|
||||
}
|
||||
|
||||
public async Task<RepoAccount> AddAsync(RepoAccount repo)
|
||||
{
|
||||
var result = await _context.RepoAccounts.AddAsync(repo);
|
||||
return result.Entity;
|
||||
}
|
||||
|
||||
public async Task<RepoAccount> FindByIdAsync(int id)
|
||||
{
|
||||
return await Queryable.Where(_context.RepoAccounts, x => x.RepoId == id)
|
||||
.IncludeAll()
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyCollection<RepoAccount>> FindByAccountNoAsync(string accountNo)
|
||||
{
|
||||
var result = await Queryable.Where<RepoAccount>(_context.RepoAccounts, x => x.AccountNo == accountNo)
|
||||
.IncludeAll().AsNoTracking().ToListAsync();
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<RepoAccount> FindByAuctionAssignmentIdAsync(int id)
|
||||
{
|
||||
RepoAccount repo = await (
|
||||
from account in _context.RepoAccounts
|
||||
join collateral in _context.Collaterals on account.RepoId equals collateral.RepoId
|
||||
join auctionAssignmentToCollateral in _context.AuctionAssignmentToCollaterals on collateral.CollateralId equals auctionAssignmentToCollateral
|
||||
.CollateralId
|
||||
where auctionAssignmentToCollateral.AuctionAssignmentId == id
|
||||
select account).FirstOrDefaultAsync();
|
||||
|
||||
return repo;
|
||||
}
|
||||
|
||||
public static string GetFormattedVIN(string vin)
|
||||
{
|
||||
return vin.Trim().PadLeft(17, '0').ToUpper();
|
||||
}
|
||||
|
||||
public void Update(RepoAccount account)
|
||||
{
|
||||
_context.Entry(account).State = EntityState.Modified;
|
||||
_context.RepoAccounts.Update(account);
|
||||
}
|
||||
|
||||
public void Remove(RepoAccount account)
|
||||
{
|
||||
_context.RepoAccounts.Remove(account);
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyCollection<RepoAccountProcessingRequest>> GetItemsForProcessing(IReadOnlyCollection<string> watchStatusList)
|
||||
{
|
||||
var accountList = await _context.RepoAccounts.Where(account =>
|
||||
account.DateClosed == null && watchStatusList.Contains(account.Status.ToUpper().Trim())).ToListAsync();
|
||||
|
||||
var list = accountList.Select(x => new RepoAccountProcessingRequest()
|
||||
{
|
||||
AccountId = x.ReferenceId.HasValue ? x.ReferenceId.ToString() : "",
|
||||
CaseId = x.ReferenceCaseId.HasValue ? x.ReferenceCaseId.ToString() : "",
|
||||
AccountNo = x.AccountNo
|
||||
});
|
||||
return list.ToList();
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyCollection<RepoAccount>> SearchRepoAccounts(string searchPhrase, int maxLimit)
|
||||
{
|
||||
var updatedSearchPhrase = searchPhrase.Trim().ToLower();
|
||||
var entities = (
|
||||
from account in _context.RepoAccounts
|
||||
join collateral in _context.Collaterals on account.RepoId equals collateral.RepoId
|
||||
join member in _context.Borrowers on account.RepoId equals member.RepoId
|
||||
where
|
||||
account.AccountNo.ToLower().Contains(updatedSearchPhrase) ||
|
||||
collateral.Vin.ToLower().Contains(updatedSearchPhrase) ||
|
||||
member.IndividualName.ToLower().Contains(updatedSearchPhrase)
|
||||
select account
|
||||
);
|
||||
|
||||
var itemsFound = entities.Count();
|
||||
if (itemsFound > maxLimit)
|
||||
{
|
||||
throw new MaxItemException(itemsFound);
|
||||
}
|
||||
|
||||
return await entities
|
||||
.IncludeAll().Distinct() /* distinct because repo can have multiple collaterals, borrowers */
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyCollection<RepoAccount>> FindByCurrentStatus(string currentStatus)
|
||||
{
|
||||
return await _context.RepoAccounts.Where(repoAccount =>
|
||||
repoAccount.Status.ToLower() == currentStatus.ToLower()).IncludeAll().ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyCollection<RepoAccount>> GetCurrentAccountsOnHoldAtAuction()
|
||||
{
|
||||
var noHoldStatus = 0;
|
||||
return await (
|
||||
from repo in _context.RepoAccounts
|
||||
join auctionAssignment in _context.AuctionAssignments on repo.RepoId equals auctionAssignment.RepoId
|
||||
where
|
||||
auctionAssignment.HoldStatus != noHoldStatus &&
|
||||
DateTime.Now < auctionAssignment.HoldUntil
|
||||
select repo).Distinct().IncludeAll().ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public class RepoCompanyRepository : BaseRepository, IRepoCompanyRepository
|
||||
{
|
||||
public RepoCompanyRepository(AppDbContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyCollection<RepoCompany>> ListAsync()
|
||||
{
|
||||
return await _context.RepoCompanies.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<RepoCompany> AddAsync(RepoCompany repoCompany)
|
||||
{
|
||||
var result = await _context.RepoCompanies.AddAsync(repoCompany);
|
||||
return result.Entity;
|
||||
}
|
||||
|
||||
public async Task<RepoCompany> FindByIdAsync(int id)
|
||||
{
|
||||
return await Queryable.Where<RepoCompany>(_context.RepoCompanies, x => x.ID == id).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
|
||||
public void Update(RepoCompany repoCompany)
|
||||
{
|
||||
_context.RepoCompanies.Update(repoCompany);
|
||||
}
|
||||
|
||||
public void Remove(RepoCompany repoCompany)
|
||||
{
|
||||
_context.RepoCompanies.Remove(repoCompany);
|
||||
}
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
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 RepoCompanySelectionRepository : BaseRepository, IRepoCompanySelectionRepository
|
||||
{
|
||||
public RepoCompanySelectionRepository(AppDbContext context) : base(context) {}
|
||||
|
||||
public async Task AddAsync(RepoCompanySelection repoCompanySelection)
|
||||
{
|
||||
repoCompanySelection.Id = null;
|
||||
repoCompanySelection.DateTimeCreated = DateTime.Now;
|
||||
await _context.RepoCompanySelections.AddAsync(repoCompanySelection);
|
||||
}
|
||||
|
||||
public async Task<RepoCompanySelection> FindByIdAsync(int id)
|
||||
{
|
||||
return await _context.RepoCompanySelections.Where(repoCompanySelection => repoCompanySelection.Id == id).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<RepoCompanySelection>> FindByCollateralIdAsync(int collateralId)
|
||||
{
|
||||
return await _context.RepoCompanySelections.Where(repoCompanySelection => repoCompanySelection.CollateralId == collateralId).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<RepoCompanySelection>> ListAllAsync()
|
||||
{
|
||||
return await _context.RepoCompanySelections.ToListAsync();
|
||||
}
|
||||
|
||||
public void Remove(RepoCompanySelection repoCompanySelection)
|
||||
{
|
||||
_context.RepoCompanySelections.Remove(repoCompanySelection);
|
||||
}
|
||||
|
||||
public void Update(RepoCompanySelection repoCompanySelection)
|
||||
{
|
||||
_context.RepoCompanySelections.Update(repoCompanySelection);
|
||||
}
|
||||
|
||||
public void SaveRange(IList<RepoCompanySelection> repoCompanySelections)
|
||||
{
|
||||
_context.RepoCompanySelections.UpdateRange(repoCompanySelections);
|
||||
}
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Exceptions;
|
||||
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 RepoManualStatusRepository : BaseRepository, IRepoManualStatusRepository
|
||||
{
|
||||
public RepoManualStatusRepository(AppDbContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyCollection<RepoManualStatus>> ListAllAsync()
|
||||
{
|
||||
return await _context.RepoManualStatuses.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyCollection<string>> ListWatchStatusesAsync()
|
||||
{
|
||||
var statusSet = await (from status in _context.RepoManualStatuses
|
||||
where status.WatchForStatusChanges == true
|
||||
select status).ToListAsync();
|
||||
|
||||
return statusSet.Select(x => x.Description).ToList() as IReadOnlyCollection<string>;
|
||||
}
|
||||
|
||||
public async Task AddAsync(RepoManualStatus repoManualStatus)
|
||||
{
|
||||
// Only Create the Alert if an identical one doesn't already exist
|
||||
var duplicateStatus = (
|
||||
from status in _context.RepoManualStatuses
|
||||
where status.Description.ToUpper().Trim() == repoManualStatus.Description.ToUpper().Trim()
|
||||
select status
|
||||
);
|
||||
|
||||
if (!duplicateStatus.Any())
|
||||
{
|
||||
await _context.RepoManualStatuses.AddAsync(repoManualStatus);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new DuplicateResourceException("RepoManualStatus");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<RepoManualStatus> FindByIdAsync(int id)
|
||||
{
|
||||
return await _context.RepoManualStatuses.FindAsync(id);
|
||||
}
|
||||
|
||||
public void Update(RepoManualStatus repoManualStatus)
|
||||
{
|
||||
_context.RepoManualStatuses.Update(repoManualStatus);
|
||||
}
|
||||
|
||||
public void Remove(RepoManualStatus repoManualStatus)
|
||||
{
|
||||
_context.RepoManualStatuses.Remove(repoManualStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
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 RepoStatusChangeRepository : BaseRepository, IRepoStatusChangeRepository
|
||||
{
|
||||
public RepoStatusChangeRepository(AppDbContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<RepoStatusChange>> ListAsync()
|
||||
{
|
||||
return await _context.RepoStatusChanges.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<RepoStatusChange>> ListForAccountAsync(int repoAccountId)
|
||||
{
|
||||
return await Queryable.Where<RepoStatusChange>(_context.RepoStatusChanges, p => p.RepoId == repoAccountId).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<RepoStatusChange> AddAsync(RepoStatusChange statusChange)
|
||||
{
|
||||
var result = await _context.RepoStatusChanges.AddAsync(statusChange);
|
||||
return result.Entity;
|
||||
}
|
||||
|
||||
public async Task<RepoStatusChange> FindByIdAsync(int id)
|
||||
{
|
||||
return await _context.RepoStatusChanges.FindAsync(id);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
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 SavedLocationRepository : BaseRepository, ISavedLocationRepository
|
||||
{
|
||||
public SavedLocationRepository(AppDbContext context) : base(context) { }
|
||||
|
||||
public async Task<IEnumerable<SavedLocation>> ListAsync()
|
||||
{
|
||||
return await _context.SavedLocations.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<SavedLocation> FindByIdAsync(int id)
|
||||
{
|
||||
return await _context.SavedLocations.Where(savedLocation => savedLocation.ID == id).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<SavedLocation> AddAsync(SavedLocation savedLocation)
|
||||
{
|
||||
var result = await _context.SavedLocations.AddAsync(savedLocation);
|
||||
return result.Entity;
|
||||
}
|
||||
|
||||
public void Update(SavedLocation savedLocation)
|
||||
{
|
||||
_context.SavedLocations.Update(savedLocation);
|
||||
}
|
||||
|
||||
public void Remove(SavedLocation savedLocation)
|
||||
{
|
||||
_context.Remove(savedLocation);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Settings;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Settings
|
||||
{
|
||||
public class AccountTypeRepository : BaseRepository, IAccountTypeRepository
|
||||
{
|
||||
|
||||
public AccountTypeRepository(AppDbContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<AccountType>> ListAllAsync()
|
||||
{
|
||||
return await _context.AccountTypeCodes.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task AddAsync(AccountType accountTypeCodes)
|
||||
{
|
||||
await _context.AccountTypeCodes.AddAsync(accountTypeCodes);
|
||||
}
|
||||
|
||||
public async Task<AccountType> FindByIdAsync(int id)
|
||||
{
|
||||
return await _context.AccountTypeCodes.Where(c => c.ID == id).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public void Update(AccountType category)
|
||||
{
|
||||
_context.AccountTypeCodes.Update(category);
|
||||
}
|
||||
|
||||
public void Remove(AccountType category)
|
||||
{
|
||||
_context.AccountTypeCodes.Remove(category);
|
||||
}
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Settings;
|
||||
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Settings
|
||||
{
|
||||
public class AllowedStatusChangeRepository : BaseRepository, IAllowedStatusChangeRepository
|
||||
{
|
||||
|
||||
public AllowedStatusChangeRepository(AppDbContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<AllowedStatusChange>> ListAllAsync()
|
||||
{
|
||||
return await _context.AllowedStatusChanges.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task AddAsync(AllowedStatusChange allowedStatusChanges)
|
||||
{
|
||||
await _context.AllowedStatusChanges.AddAsync(allowedStatusChanges);
|
||||
}
|
||||
|
||||
public async Task<AllowedStatusChange> FindByIdAsync(int id)
|
||||
{
|
||||
return await _context.AllowedStatusChanges.Where(c => c.ID == id).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public void Update(AllowedStatusChange category)
|
||||
{
|
||||
_context.AllowedStatusChanges.Update(category);
|
||||
}
|
||||
|
||||
public void Remove(AllowedStatusChange category)
|
||||
{
|
||||
_context.AllowedStatusChanges.Remove(category);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Settings;
|
||||
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Settings
|
||||
{
|
||||
public class BodyStyleRepository : BaseRepository, IBodyStyleRepository
|
||||
{
|
||||
|
||||
public BodyStyleRepository(AppDbContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<BodyStyle>> ListAllAsync()
|
||||
{
|
||||
return await _context.BodyStyleCodes.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task AddAsync(BodyStyle bodyStyleCodes)
|
||||
{
|
||||
await _context.BodyStyleCodes.AddAsync(bodyStyleCodes);
|
||||
}
|
||||
|
||||
public async Task<BodyStyle> FindByIdAsync(string id)
|
||||
{
|
||||
return await _context.BodyStyleCodes.Where(c => c.Code.Equals(id)).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public void Update(BodyStyle category)
|
||||
{
|
||||
_context.BodyStyleCodes.Update(category);
|
||||
}
|
||||
|
||||
public void Remove(BodyStyle category)
|
||||
{
|
||||
_context.BodyStyleCodes.Remove(category);
|
||||
}
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Settings;
|
||||
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Settings
|
||||
{
|
||||
public class CleaningLevelRepository : BaseRepository, ICleaningLevelRepository
|
||||
{
|
||||
|
||||
public CleaningLevelRepository(AppDbContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<CleaningLevel>> ListAllAsync()
|
||||
{
|
||||
return await _context.CleaningLevelCodes.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task AddAsync(CleaningLevel cleaningLevelCodes)
|
||||
{
|
||||
await _context.CleaningLevelCodes.AddAsync(cleaningLevelCodes);
|
||||
}
|
||||
|
||||
public async Task<CleaningLevel> FindByIdAsync(int id)
|
||||
{
|
||||
return await _context.CleaningLevelCodes.Where(c => c.Code == id).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public void Update(CleaningLevel category)
|
||||
{
|
||||
_context.CleaningLevelCodes.Update(category);
|
||||
}
|
||||
|
||||
public void Remove(CleaningLevel category)
|
||||
{
|
||||
_context.CleaningLevelCodes.Remove(category);
|
||||
}
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Settings;
|
||||
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Settings
|
||||
{
|
||||
public class CollateralTypeRepository : BaseRepository, ICollateralTypeRepository
|
||||
{
|
||||
|
||||
public CollateralTypeRepository(AppDbContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<CollateralType>> ListAllAsync()
|
||||
{
|
||||
return await _context.CollateralTypes.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task AddAsync(CollateralType collateralTypes)
|
||||
{
|
||||
await _context.CollateralTypes.AddAsync(collateralTypes);
|
||||
}
|
||||
|
||||
public async Task<CollateralType> FindByIdAsync(int id)
|
||||
{
|
||||
return await _context.CollateralTypes.Where(c => c.ID == id).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public void Update(CollateralType category)
|
||||
{
|
||||
_context.CollateralTypes.Update(category);
|
||||
}
|
||||
|
||||
public void Remove(CollateralType category)
|
||||
{
|
||||
_context.CollateralTypes.Remove(category);
|
||||
}
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Settings;
|
||||
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Settings
|
||||
{
|
||||
public class CollateralTypeToVehicleTypeRepository : BaseRepository, ICollateralTypeToVehicleTypeRepository
|
||||
{
|
||||
|
||||
public CollateralTypeToVehicleTypeRepository(AppDbContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<CollateralTypeToVehicleType>> ListAllAsync()
|
||||
{
|
||||
return await _context.CollateralTypesToVehicleTypes.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task AddAsync(CollateralTypeToVehicleType collateralTypesToVehicleTypes)
|
||||
{
|
||||
await _context.CollateralTypesToVehicleTypes.AddAsync(collateralTypesToVehicleTypes);
|
||||
}
|
||||
|
||||
public async Task<CollateralTypeToVehicleType> FindByIdAsync(int id)
|
||||
{
|
||||
return await _context.CollateralTypesToVehicleTypes.Where(c => c.ID == id).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public void Update(CollateralTypeToVehicleType category)
|
||||
{
|
||||
_context.CollateralTypesToVehicleTypes.Update(category);
|
||||
}
|
||||
|
||||
public void Remove(CollateralTypeToVehicleType category)
|
||||
{
|
||||
_context.CollateralTypesToVehicleTypes.Remove(category);
|
||||
}
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Settings;
|
||||
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Settings
|
||||
{
|
||||
public class HoldStatusRepository : BaseRepository, IHoldStatusRepository
|
||||
{
|
||||
|
||||
public HoldStatusRepository(AppDbContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<HoldStatus>> ListAllAsync()
|
||||
{
|
||||
return await _context.HoldStatusCodes.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task AddAsync(HoldStatus holdStatusCodes)
|
||||
{
|
||||
await _context.HoldStatusCodes.AddAsync(holdStatusCodes);
|
||||
}
|
||||
|
||||
public async Task<HoldStatus> FindByIdAsync(int id)
|
||||
{
|
||||
return await _context.HoldStatusCodes.Where(c => c.Code == id).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public void Update(HoldStatus category)
|
||||
{
|
||||
_context.HoldStatusCodes.Update(category);
|
||||
}
|
||||
|
||||
public void Remove(HoldStatus category)
|
||||
{
|
||||
_context.HoldStatusCodes.Remove(category);
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Settings;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Settings
|
||||
{
|
||||
public interface IAccountTypeRepository
|
||||
{
|
||||
Task<IEnumerable<AccountType>> ListAllAsync();
|
||||
Task AddAsync(AccountType code);
|
||||
Task<AccountType> FindByIdAsync(int id);
|
||||
void Update(AccountType code);
|
||||
void Remove(AccountType code);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Settings;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Settings
|
||||
{
|
||||
public interface IAllowedStatusChangeRepository
|
||||
{
|
||||
Task<IEnumerable<AllowedStatusChange>> ListAllAsync();
|
||||
Task AddAsync(AllowedStatusChange change);
|
||||
Task<AllowedStatusChange> FindByIdAsync(int id);
|
||||
void Update(AllowedStatusChange change);
|
||||
void Remove(AllowedStatusChange change);
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Settings;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Settings
|
||||
{
|
||||
public interface IBodyStyleRepository
|
||||
{
|
||||
Task<IEnumerable<BodyStyle>> ListAllAsync();
|
||||
Task AddAsync(BodyStyle code);
|
||||
Task<BodyStyle> FindByIdAsync(string id);
|
||||
void Update(BodyStyle code);
|
||||
void Remove(BodyStyle code);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Settings;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Settings
|
||||
{
|
||||
public interface ICleaningLevelRepository
|
||||
{
|
||||
Task<IEnumerable<CleaningLevel>> ListAllAsync();
|
||||
Task AddAsync(CleaningLevel code);
|
||||
Task<CleaningLevel> FindByIdAsync(int id);
|
||||
void Update(CleaningLevel code);
|
||||
void Remove(CleaningLevel code);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Settings;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Settings
|
||||
{
|
||||
public interface ICollateralTypeRepository
|
||||
{
|
||||
Task<IEnumerable<CollateralType>> ListAllAsync();
|
||||
Task AddAsync(CollateralType type);
|
||||
Task<CollateralType> FindByIdAsync(int id);
|
||||
void Update(CollateralType type);
|
||||
void Remove(CollateralType type);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Settings;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Settings
|
||||
{
|
||||
public interface ICollateralTypeToVehicleTypeRepository
|
||||
{
|
||||
Task<IEnumerable<CollateralTypeToVehicleType>> ListAllAsync();
|
||||
Task AddAsync(CollateralTypeToVehicleType type);
|
||||
Task<CollateralTypeToVehicleType> FindByIdAsync(int id);
|
||||
void Update(CollateralTypeToVehicleType type);
|
||||
void Remove(CollateralTypeToVehicleType type);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Settings;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Settings
|
||||
{
|
||||
public interface IHoldStatusRepository
|
||||
{
|
||||
Task<IEnumerable<HoldStatus>> ListAllAsync();
|
||||
Task AddAsync(HoldStatus code);
|
||||
Task<HoldStatus> FindByIdAsync(int id);
|
||||
void Update(HoldStatus code);
|
||||
void Remove(HoldStatus code);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Settings;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Settings
|
||||
{
|
||||
public interface ILoanCategoryRepository
|
||||
{
|
||||
Task<IEnumerable<LoanCategory>> ListAllAsync();
|
||||
Task AddAsync(LoanCategory category);
|
||||
Task<LoanCategory> FindByIdAsync(int id);
|
||||
void Update(LoanCategory category);
|
||||
void Remove(LoanCategory category);
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Settings;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Settings
|
||||
{
|
||||
public interface ILocationTypeRepository
|
||||
{
|
||||
Task<IEnumerable<LocationType>> ListAllAsync();
|
||||
Task AddAsync(LocationType code);
|
||||
Task<LocationType> FindByIdAsync(int id);
|
||||
void Update(LocationType code);
|
||||
void Remove(LocationType code);
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Settings;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Settings
|
||||
{
|
||||
public interface IVehicleTypeRepository
|
||||
{
|
||||
Task<IEnumerable<VehicleType>> ListAllAsync();
|
||||
Task AddAsync(VehicleType code);
|
||||
Task<VehicleType> FindByIdAsync(string id);
|
||||
void Update(VehicleType code);
|
||||
void Remove(VehicleType code);
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Settings;
|
||||
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Settings
|
||||
{
|
||||
public class LoanCategoryRepository : BaseRepository, ILoanCategoryRepository
|
||||
{
|
||||
|
||||
public LoanCategoryRepository(AppDbContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<LoanCategory>> ListAllAsync()
|
||||
{
|
||||
return await _context.LoanCategories.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task AddAsync(LoanCategory loanCategories)
|
||||
{
|
||||
await _context.LoanCategories.AddAsync(loanCategories);
|
||||
}
|
||||
|
||||
public async Task<LoanCategory> FindByIdAsync(int id)
|
||||
{
|
||||
return await _context.LoanCategories.Where(c => c.ID == id).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public void Update(LoanCategory category)
|
||||
{
|
||||
_context.LoanCategories.Update(category);
|
||||
}
|
||||
|
||||
public void Remove(LoanCategory category)
|
||||
{
|
||||
_context.LoanCategories.Remove(category);
|
||||
}
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Settings;
|
||||
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Settings
|
||||
{
|
||||
public class LocationTypeRepository : BaseRepository, ILocationTypeRepository
|
||||
{
|
||||
|
||||
public LocationTypeRepository(AppDbContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<LocationType>> ListAllAsync()
|
||||
{
|
||||
return await _context.LocationTypeCodes.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task AddAsync(LocationType locationTypeCodes)
|
||||
{
|
||||
await _context.LocationTypeCodes.AddAsync(locationTypeCodes);
|
||||
}
|
||||
|
||||
public async Task<LocationType> FindByIdAsync(int id)
|
||||
{
|
||||
return await _context.LocationTypeCodes.Where(c => c.Code == id).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public void Update(LocationType category)
|
||||
{
|
||||
_context.LocationTypeCodes.Update(category);
|
||||
}
|
||||
|
||||
public void Remove(LocationType category)
|
||||
{
|
||||
_context.LocationTypeCodes.Remove(category);
|
||||
}
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Models.Settings;
|
||||
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories.Settings
|
||||
{
|
||||
public class VehicleTypeRepository : BaseRepository, IVehicleTypeRepository
|
||||
{
|
||||
public VehicleTypeRepository(AppDbContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<VehicleType>> ListAllAsync()
|
||||
{
|
||||
return await _context.VehicleTypeCodes.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task AddAsync(VehicleType vehicleTypeCodes)
|
||||
{
|
||||
await _context.VehicleTypeCodes.AddAsync(vehicleTypeCodes);
|
||||
}
|
||||
|
||||
public async Task<VehicleType> FindByIdAsync(string id)
|
||||
{
|
||||
return await _context.VehicleTypeCodes.Where(c => c.Code.Equals(id)).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public void Update(VehicleType category)
|
||||
{
|
||||
_context.VehicleTypeCodes.Update(category);
|
||||
}
|
||||
|
||||
public void Remove(VehicleType category)
|
||||
{
|
||||
_context.VehicleTypeCodes.Remove(category);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public class UnitOfWork : IUnitOfWork
|
||||
{
|
||||
private readonly AppDbContext _context;
|
||||
|
||||
public UnitOfWork(AppDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task CompleteAsync()
|
||||
{
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
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 VehicleFloorPricingParametersRepository : BaseRepository, IVehicleFloorPricingParametersRepository
|
||||
{
|
||||
|
||||
public VehicleFloorPricingParametersRepository(AppDbContext context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<VehicleFloorPricingParameters>> ListAllAsync()
|
||||
{
|
||||
return await _context.VehicleFloorPricingParameters.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task AddAsync(VehicleFloorPricingParameters parameters)
|
||||
{
|
||||
await _context.VehicleFloorPricingParameters.AddAsync(parameters);
|
||||
}
|
||||
|
||||
public async Task<VehicleFloorPricingParameters> FindByIdAsync(int id)
|
||||
{
|
||||
return await Queryable.Where<VehicleFloorPricingParameters>(_context.VehicleFloorPricingParameters, c => c.Id == id).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public void Update(VehicleFloorPricingParameters parameters)
|
||||
{
|
||||
_context.VehicleFloorPricingParameters.Update(parameters);
|
||||
}
|
||||
|
||||
public void Remove(VehicleFloorPricingParameters parameters)
|
||||
{
|
||||
_context.VehicleFloorPricingParameters.Remove(parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user