forked from ddrilling/AsbCloudServer
40 lines
1.3 KiB
C#
40 lines
1.3 KiB
C#
using AsbCloudApp.Data;
|
|
using AsbCloudApp.Services;
|
|
using AsbCloudDb.Model;
|
|
using AsbCloudInfrastructure.Repository;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace AsbCloudInfrastructure.Services
|
|
{
|
|
public class FileCategoryService : CrudCacheServiceBase<FileCategoryDto, FileCategory>, IFileCategoryService
|
|
{
|
|
private readonly IAsbCloudDbContext db;
|
|
|
|
public FileCategoryService(IAsbCloudDbContext context)
|
|
: base(context)
|
|
{
|
|
this.db = context;
|
|
}
|
|
|
|
public async Task<IEnumerable<FileCategoryDto>> GetWellCategoryAsync(CancellationToken token)
|
|
{
|
|
var data = await (from category in db.FileCategories
|
|
where category.Id >= 10000 && category.Id <= 20000
|
|
select new FileCategoryDto
|
|
{
|
|
Id = category.Id,
|
|
Name = category.Name,
|
|
ShortName = category.ShortName
|
|
})
|
|
.ToListAsync(token)
|
|
.ConfigureAwait(false);
|
|
|
|
return data.ToList();
|
|
}
|
|
}
|
|
}
|