2026-04-30 10:35:31 +10:00
|
|
|
|
using Microsoft.Extensions.Logging;
|
2026-07-03 11:17:48 +10:00
|
|
|
|
using PARR.Core.Repositories.Interfaces.JobRepositories;
|
2026-04-30 10:35:31 +10:00
|
|
|
|
using PARR.DAL.Context;
|
|
|
|
|
|
using PARR.DAL.Repositories.Base;
|
2026-07-03 11:17:48 +10:00
|
|
|
|
using PARR.Domain.Entities.JobEntities;
|
2026-04-30 10:35:31 +10:00
|
|
|
|
|
2026-07-03 11:17:48 +10:00
|
|
|
|
namespace PARR.DAL.Repositories.JobRepositories
|
2026-04-30 10:35:31 +10:00
|
|
|
|
{
|
2026-07-03 11:17:48 +10:00
|
|
|
|
internal class JobRepository : BaseRepository<Domain.Entities.JobEntities.Job>, IJobRepository
|
2026-04-30 10:35:31 +10:00
|
|
|
|
{
|
|
|
|
|
|
public JobRepository(DataContext dataContext, ILogger<JobRepository> logger) : base(logger, dataContext) { }
|
|
|
|
|
|
|
2026-07-03 11:17:48 +10:00
|
|
|
|
public override Task<bool> CreateAsync(Domain.Entities.JobEntities.Job obj)
|
2026-04-30 10:35:31 +10:00
|
|
|
|
{
|
|
|
|
|
|
if (obj.AutoControl == null)
|
|
|
|
|
|
obj.AutoControl = new JobAutoControl
|
|
|
|
|
|
{
|
|
|
|
|
|
JobId = obj.Id
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return base.CreateAsync(obj);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-07-03 11:17:48 +10:00
|
|
|
|
public override Task<bool> AddRangeAsync(List<Domain.Entities.JobEntities.Job> objs)
|
2026-04-30 10:35:31 +10:00
|
|
|
|
{
|
|
|
|
|
|
objs.ForEach(job =>
|
|
|
|
|
|
{
|
|
|
|
|
|
if (job.AutoControl == null)
|
|
|
|
|
|
job.AutoControl = new JobAutoControl
|
|
|
|
|
|
{
|
|
|
|
|
|
JobId = job.Id
|
|
|
|
|
|
};
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
return base.AddRangeAsync(objs);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|