54 lines
1.9 KiB
C#
54 lines
1.9 KiB
C#
using System.Threading.Tasks;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using LCU.API.Internal.DocumentIngestorLib.Persistence;
|
|
using LCU.Library.Internal.DocumentIngestorModels.Entities;
|
|
|
|
namespace LCU.API.Internal.DocumentIngestorLib.Repositories
|
|
{
|
|
public class ProcessingLogRepository : BaseRepository, IProcessingLogRepository
|
|
{
|
|
public ProcessingLogRepository(AppDbContext context) : base(context) { }
|
|
|
|
public async Task<IEnumerable<ProcessingLog>> FindAsync()
|
|
{
|
|
return await _context.ProcessingLogs.ToListAsync();
|
|
}
|
|
|
|
public async Task<ProcessingLog> FindByIdAsync(int id)
|
|
{
|
|
return await _context.ProcessingLogs
|
|
.FirstOrDefaultAsync(processingLog => processingLog.ProcessingLogId == id);
|
|
}
|
|
|
|
public async Task<IEnumerable<ProcessingLog>> FindByDocumentProcessingInfoIdAsync(int documentProcessingInfoId)
|
|
{
|
|
return await _context.ProcessingLogs
|
|
.Where(processingLog => processingLog.DocumentProcessingInfoId == documentProcessingInfoId)
|
|
.ToListAsync();
|
|
}
|
|
|
|
public async Task<ProcessingLog> AddAsync(ProcessingLog processingLog)
|
|
{
|
|
var result = await _context.ProcessingLogs.AddAsync(processingLog);
|
|
return result.Entity;
|
|
}
|
|
|
|
public async Task AddRangeAsync(IEnumerable<ProcessingLog> processingLogs)
|
|
{
|
|
await _context.ProcessingLogs.AddRangeAsync(processingLogs);
|
|
}
|
|
|
|
public void Update(ProcessingLog processingLog)
|
|
{
|
|
_context.ProcessingLogs.Update(processingLog);
|
|
}
|
|
|
|
public void Remove(ProcessingLog processingLog)
|
|
{
|
|
_context.ProcessingLogs.Remove(processingLog);
|
|
}
|
|
}
|
|
}
|