21 lines
890 B
C#
21 lines
890 B
C#
using BackOffice.BFF.Application.UserCQ.Commands.CreateNewUser;
|
|
using CMSMicroservice.Protobuf.Protos.UserAddress;
|
|
|
|
namespace BackOffice.BFF.Application.UserAddressCQ.Commands.CreateNewUserAddress;
|
|
public class CreateNewUserAddressCommandHandler : IRequestHandler<CreateNewUserAddressCommand, CreateNewUserAddressResponseDto>
|
|
{
|
|
private readonly IApplicationContractContext _context;
|
|
|
|
public CreateNewUserAddressCommandHandler(IApplicationContractContext context)
|
|
{
|
|
_context = context;
|
|
}
|
|
|
|
public async Task<CreateNewUserAddressResponseDto> Handle(CreateNewUserAddressCommand request, CancellationToken cancellationToken)
|
|
{
|
|
var response = await _context.UserAddress.CreateNewUserAddressAsync(request.Adapt<CreateNewUserAddressRequest>(), cancellationToken: cancellationToken);
|
|
|
|
return response.Adapt<CreateNewUserAddressResponseDto>();
|
|
}
|
|
}
|