38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Logging;
|
|
using PARR.DAL.Context;
|
|
using PARR.DAL.Models.Unit;
|
|
using PARR.DAL.Services.Interfaces.Unit;
|
|
|
|
namespace PARR.DAL.Services.Implementations.Unit
|
|
{
|
|
internal class UnitInValueService : IUnitInValueService
|
|
{
|
|
private readonly ILogger<UnitInValueService> logger;
|
|
private readonly DataContext dataContext;
|
|
|
|
public UnitInValueService(
|
|
ILogger<UnitInValueService> logger,
|
|
DataContext dataContext
|
|
)
|
|
{
|
|
this.logger = logger;
|
|
this.dataContext = dataContext;
|
|
}
|
|
|
|
public async Task<List<UnitInValue>> GetByUnitIdAsync(Guid unitId)
|
|
{
|
|
return await dataContext.UnitInValues
|
|
.Where(uv => uv.UnitId == unitId)
|
|
.ToListAsync();
|
|
}
|
|
|
|
public async Task<List<UnitInValue>> GetByUnitIdsAsync(IEnumerable<Guid> unitIds)
|
|
{
|
|
return await dataContext.UnitInValues
|
|
.Where(uv => unitIds.Contains(uv.UnitId))
|
|
.ToListAsync();
|
|
}
|
|
}
|
|
}
|