29 lines
1.4 KiB
C#
29 lines
1.4 KiB
C#
using FreeSql;
|
|
using F9WebAiTest.Application.Dtos.SYS.Registries;
|
|
using F9WebAiTest.Application.Interfaces.Repositories.SYS.Registries;
|
|
using F9WebAiTest.Domain.Entities.SYS.Registries;
|
|
|
|
namespace F9WebAiTest.Infrastructure.FreeSqls.Repositories.SYS.Registries;
|
|
|
|
internal class RegistryReadRepository : F9RepositoryBase, IRegistryReadRepository
|
|
{
|
|
public RegistryReadRepository(IFreeSql fsql) : base(fsql) { }
|
|
|
|
public async Task<List<RegistryReadDto_View>> GetAllAsync()
|
|
=> await Orm.Select<Registry>()
|
|
.Where(x => x.DeletedAt == null)
|
|
.OrderBy(x => x.Category)
|
|
.OrderBy(x => x.KeyName)
|
|
.ToListAsync(x => new RegistryReadDto_View(x.Id, x.Category, x.KeyName, x.Value, x.DataType, x.Description, x.IsActive));
|
|
|
|
public async Task<RegistryReadDto_Edit> GetByIdForEditAsync(long id)
|
|
=> await Orm.Select<Registry>()
|
|
.Where(x => x.Id == id && x.DeletedAt == null)
|
|
.FirstAsync(x => new RegistryReadDto_Edit(x.Id, x.Category, x.KeyName, x.Value, x.DataType, x.Description, x.IsActive));
|
|
|
|
public async Task<RegistryReadDto_Edit> GetByCategoryAndKeyAsync(string category, string keyName)
|
|
=> await Orm.Select<Registry>()
|
|
.Where(x => x.DeletedAt == null && x.Category == category && x.KeyName == keyName)
|
|
.FirstAsync(x => new RegistryReadDto_Edit(x.Id, x.Category, x.KeyName, x.Value, x.DataType, x.Description, x.IsActive));
|
|
}
|