[Add] MasterData Services.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.District;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.District;
|
||||
|
||||
namespace AMREZ.EOP.Application.UseCases.MasterData.District;
|
||||
|
||||
public sealed class GetDistrictUseCase : IGetDistrictUseCase
|
||||
{
|
||||
private readonly IDistrictRepository _repo;
|
||||
|
||||
public GetDistrictUseCase(IDistrictRepository repo)
|
||||
{
|
||||
_repo = repo;
|
||||
}
|
||||
|
||||
public async Task<DistrictResponse?> ExecuteAsync(Guid id, CancellationToken ct = default)
|
||||
{
|
||||
var e = await _repo.GetAsync(id, ct);
|
||||
if (e is null) return null;
|
||||
|
||||
return new DistrictResponse(
|
||||
e.Id,
|
||||
e.Scope,
|
||||
e.Code,
|
||||
e.Name,
|
||||
e.NameI18n,
|
||||
e.OverridesGlobalId,
|
||||
e.IsActive,
|
||||
e.IsSystem,
|
||||
e.Meta,
|
||||
e.Code,
|
||||
e.ProvinceId,
|
||||
e.Province.Name,
|
||||
e.Province.Code
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user