50 lines
1.9 KiB
C#
50 lines
1.9 KiB
C#
using System;
|
|
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 PdfPartitionerLogRepository : BaseRepository, IPdfPartitionerLogRepository
|
|
{
|
|
public PdfPartitionerLogRepository(AppDbContext context) : base(context) { }
|
|
|
|
public async Task<IEnumerable<PdfPartitionerLog>> FindAsync()
|
|
{
|
|
return await _context.PdfPartitionerLogs.ToListAsync();
|
|
}
|
|
|
|
public async Task<PdfPartitionerLog> FindByIdAsync(int id)
|
|
{
|
|
return await _context.PdfPartitionerLogs
|
|
.FirstOrDefaultAsync(pdfPartitionerLog => pdfPartitionerLog.PdfPartitionerLogId == id);
|
|
}
|
|
|
|
public async Task<IEnumerable<PdfPartitionerLog>> FindByPdfPartitionerRunInfoIdAsync(Guid pdfPartitionerRunInfoId)
|
|
{
|
|
return await _context.PdfPartitionerLogs
|
|
.Where(pdfPartitionerLog => pdfPartitionerLog.PdfPartitionerRunInfoId == pdfPartitionerRunInfoId)
|
|
.ToListAsync();
|
|
}
|
|
|
|
public async Task AddRangeAsync(IEnumerable<PdfPartitionerLog> pdfPartitionerLogs)
|
|
{
|
|
await _context.PdfPartitionerLogs.AddRangeAsync(pdfPartitionerLogs);
|
|
}
|
|
|
|
public async Task<PdfPartitionerLog> AddAsync(PdfPartitionerLog pdfPartitionerLog)
|
|
{
|
|
var result = await _context.PdfPartitionerLogs.AddAsync(pdfPartitionerLog);
|
|
return result.Entity;
|
|
}
|
|
|
|
public void Remove(PdfPartitionerLog pdfPartitionerLog)
|
|
{
|
|
_context.PdfPartitionerLogs.Remove(pdfPartitionerLog);
|
|
}
|
|
}
|
|
}
|