feat: Из dal перенесены все модели в Domain. Из dal переименованы service в repository, вынесены в Core.
This commit is contained in:
39
PARR.DAL/Repositories/Job/JobRepository.cs
Normal file
39
PARR.DAL/Repositories/Job/JobRepository.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using PARR.Core.Repositories.Interfaces.Job;
|
||||
using PARR.DAL.Context;
|
||||
using PARR.DAL.Repositories.Base;
|
||||
using PARR.Domain.Entities.Job;
|
||||
|
||||
namespace PARR.DAL.Repositories.Job
|
||||
{
|
||||
internal class JobRepository : BaseRepository<Domain.Entities.Job.Job>, IJobRepository
|
||||
{
|
||||
public JobRepository(DataContext dataContext, ILogger<JobRepository> logger) : base(logger, dataContext) { }
|
||||
|
||||
public override Task<bool> CreateAsync(Domain.Entities.Job.Job obj)
|
||||
{
|
||||
if (obj.AutoControl == null)
|
||||
obj.AutoControl = new JobAutoControl
|
||||
{
|
||||
JobId = obj.Id
|
||||
};
|
||||
|
||||
return base.CreateAsync(obj);
|
||||
}
|
||||
|
||||
|
||||
public override Task<bool> AddRangeAsync(List<Domain.Entities.Job.Job> objs)
|
||||
{
|
||||
objs.ForEach(job =>
|
||||
{
|
||||
if (job.AutoControl == null)
|
||||
job.AutoControl = new JobAutoControl
|
||||
{
|
||||
JobId = job.Id
|
||||
};
|
||||
});
|
||||
|
||||
return base.AddRangeAsync(objs);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user