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