forked from ddrilling/AsbCloudServer
Степанов Дмитрий Александрович
e56530a10f
1. Добавил сервисы и репозитории для инфструкций 2. Добавил контроллеры 3. Обновил конфиг
32 lines
1.0 KiB
C#
32 lines
1.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using AsbCloudApp.Data;
|
|
using AsbCloudApp.Repositories;
|
|
using AsbCloudDb.Model;
|
|
using Mapster;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Caching.Memory;
|
|
|
|
namespace AsbCloudInfrastructure.Repository;
|
|
|
|
public class FileCategoryRepository : CrudCacheRepositoryBase<FileCategoryDto, FileCategory>, IFileCategoryRepository
|
|
{
|
|
public FileCategoryRepository(IAsbCloudDbContext dbContext, IMemoryCache memoryCache) : base(dbContext, memoryCache)
|
|
{
|
|
}
|
|
|
|
public FileCategoryRepository(IAsbCloudDbContext dbContext, IMemoryCache memoryCache,
|
|
Func<DbSet<FileCategory>, IQueryable<FileCategory>> makeQuery) : base(dbContext, memoryCache, makeQuery)
|
|
{
|
|
}
|
|
|
|
public async Task<IEnumerable<FileCategoryDto>> GetAllAsync(int idType, CancellationToken cancellationToken)
|
|
{
|
|
return await dbContext.FileCategories.Where(f => f.IdType == idType)
|
|
.Select(f => f.Adapt<FileCategoryDto>())
|
|
.ToArrayAsync(cancellationToken);
|
|
}
|
|
} |