using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using PARR.DAL.Context; using PARR.DAL.Models.Unit; using PARR.DAL.Services.Abstracts; using PARR.DAL.Services.Interfaces.Unit; namespace PARR.DAL.Services.Implementations.Unit { internal class UnitInUnitService : IUnitInUnitService { private readonly DataContext dataContext; private readonly ILogger logger; public UnitInUnitService( DataContext dataContext, ILogger logger ) { this.dataContext = dataContext; this.logger = logger; } public Task> GetByParentIdAsync(Guid parentId) { return dataContext.UnitInUnits .Where(u => u.ParentUnitId == parentId) .ToListAsync(); } public Task> GetByChildIdAsync(Guid childId) { return dataContext.UnitInUnits .Where(u => u.ChildUnitId == childId) .ToListAsync(); } } }