41 lines
1.1 KiB
C#
41 lines
1.1 KiB
C#
using AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Subdistrict;
|
|
using AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
|
using AMREZ.EOP.Contracts.DTOs.MasterData.Subdistrict;
|
|
|
|
namespace AMREZ.EOP.Application.UseCases.MasterData.Subdistricts;
|
|
|
|
public sealed class GetSubdistrictUseCase : IGetSubdistrictUseCase
|
|
{
|
|
private readonly ISubdistrictRepository _repo;
|
|
|
|
public GetSubdistrictUseCase(ISubdistrictRepository repo)
|
|
{
|
|
_repo = repo;
|
|
}
|
|
|
|
public async Task<SubdistrictResponse?> ExecuteAsync(Guid id, CancellationToken ct = default)
|
|
{
|
|
var e = await _repo.GetAsync(id, ct);
|
|
if (e is null) return null;
|
|
|
|
return new SubdistrictResponse(
|
|
e.Id,
|
|
e.Scope,
|
|
e.Code,
|
|
e.Name,
|
|
e.NameI18n,
|
|
e.OverridesGlobalId,
|
|
e.IsActive,
|
|
e.IsSystem,
|
|
e.Meta,
|
|
e.Code,
|
|
e.Postcode,
|
|
e.DistrictId,
|
|
e.District.Name,
|
|
e.District.Code,
|
|
e.District.ProvinceId,
|
|
e.District.Province.Name,
|
|
e.District.Province.Code
|
|
);
|
|
}
|
|
} |