forked from ddrilling/AsbCloudServer
33 lines
962 B
C#
33 lines
962 B
C#
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Threading;
|
||
|
using System.Threading.Tasks;
|
||
|
using AsbCloudApp.Data.Manuals;
|
||
|
using AsbCloudApp.Repositories;
|
||
|
using AsbCloudDb.Model;
|
||
|
using AsbCloudDb.Model.Manuals;
|
||
|
using Mapster;
|
||
|
using Microsoft.EntityFrameworkCore;
|
||
|
|
||
|
namespace AsbCloudInfrastructure.Repository;
|
||
|
|
||
|
public class ManualRepository : CrudRepositoryBase<ManualDto, Manual>, IManualRepository
|
||
|
{
|
||
|
public ManualRepository(IAsbCloudDbContext context) : base(context)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
public ManualRepository(IAsbCloudDbContext context, Func<DbSet<Manual>, IQueryable<Manual>> makeQuery)
|
||
|
: base(context, makeQuery)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
public async Task<IEnumerable<ManualDto>> GetManualsWithoutFolderAsync(int idCategory, CancellationToken cancellationToken)
|
||
|
{
|
||
|
return await dbContext.Manuals.Where(m => m.IdCategory == idCategory &&
|
||
|
m.IdFolder == null)
|
||
|
.Select(m => m.Adapt<ManualDto>())
|
||
|
.ToArrayAsync(cancellationToken);
|
||
|
}
|
||
|
}
|