37 lines
996 B
C#
37 lines
996 B
C#
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
|
|
);
|
|
}
|
|
} |