feat(aihitMainSyncer): Написана логика создания новых Unit и Field.
This commit is contained in:
@@ -19,5 +19,10 @@ namespace PARR.DAL.Services.Implementations.Unit
|
||||
{
|
||||
this.dataContext = dataContext;
|
||||
}
|
||||
|
||||
public async Task<UnitField?> GetByAihitNameAsync(string name)
|
||||
{
|
||||
return await EntitySet.FirstOrDefaultAsync(uf => uf.AihitName.ToLower() == name.ToLower());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,5 +18,20 @@ namespace PARR.DAL.Services.Implementations.Unit
|
||||
{
|
||||
this.dataContext = dataContext;
|
||||
}
|
||||
|
||||
|
||||
public async Task<Models.Unit.Unit?> GetUnitWithFieldsAsync(string name)
|
||||
{
|
||||
return await GetUnitWithIncludeFields()
|
||||
.FirstOrDefaultAsync(u => u.Name.ToLower() == name.ToLower());
|
||||
}
|
||||
|
||||
|
||||
private IQueryable<Models.Unit.Unit> GetUnitWithIncludeFields()
|
||||
{
|
||||
return EntitySet
|
||||
.Include(t => t.UnitFields)
|
||||
.ThenInclude(f => f.UnitField);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@ using PARR.DAL.Services.Interfaces.Base;
|
||||
|
||||
namespace PARR.DAL.Services.Interfaces.Unit
|
||||
{
|
||||
public interface IUnitFieldService: IBaseService<UnitField>
|
||||
public interface IUnitFieldService : IBaseService<UnitField>
|
||||
{
|
||||
Task<UnitField?> GetByAihitNameAsync(string name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,5 +4,6 @@ namespace PARR.DAL.Services.Interfaces.Unit
|
||||
{
|
||||
public interface IUnitService : IBaseService<Models.Unit.Unit>
|
||||
{
|
||||
Task<Models.Unit.Unit?> GetUnitWithFieldsAsync(string name);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user