This commit is contained in:
Mikhail Kuznetsov
2025-05-30 09:52:55 +10:00
4 changed files with 242 additions and 243 deletions

View File

@@ -18,22 +18,5 @@ namespace PARR.DAL.Services.Implementations.Unit
{
this.dataContext = dataContext;
}
public async Task<Models.Unit.Unit?> GetByName(string name)
{
return await GetUnitWithFieldsAndValues()
.FirstOrDefaultAsync(u => u.Name.ToLower().Trim() == name.ToLower().Trim());
}
private IQueryable<Models.Unit.Unit> GetUnitWithFieldsAndValues()
{
return EntitySet
.Include(u => u.UnitFields)
.ThenInclude(f => f.UnitField)
.Include(u => u.UnitValues)
.ThenInclude(v => v.Value);
}
}
}

View File

@@ -4,6 +4,5 @@ namespace PARR.DAL.Services.Interfaces.Unit
{
public interface IUnitService : IBaseService<Models.Unit.Unit>
{
Task<Models.Unit.Unit?> GetByName(string name);
}
}