This commit is contained in:
masoodafar-web
2025-11-25 02:46:57 +03:30
parent 50ccd10e24
commit 34f66fcb2d
14 changed files with 457 additions and 420 deletions

View File

@@ -1,16 +1,28 @@
using CMSMicroservice.Protobuf.Protos.UserOrder;
namespace FrontOffice.BFF.Application.UserOrderCQ.Commands.SubmitShopBuyOrder;
public class SubmitShopBuyOrderCommandHandler : IRequestHandler<SubmitShopBuyOrderCommand, SubmitShopBuyOrderResponseDto>
public class
SubmitShopBuyOrderCommandHandler : IRequestHandler<SubmitShopBuyOrderCommand, SubmitShopBuyOrderResponseDto>
{
private readonly IApplicationContractContext _context;
private readonly ICurrentUserService _currentUserService;
public SubmitShopBuyOrderCommandHandler(IApplicationContractContext context)
public SubmitShopBuyOrderCommandHandler(IApplicationContractContext context, ICurrentUserService currentUserService)
{
_context = context;
_currentUserService = currentUserService;
}
public async Task<SubmitShopBuyOrderResponseDto> Handle(SubmitShopBuyOrderCommand request, CancellationToken cancellationToken)
public async Task<SubmitShopBuyOrderResponseDto> Handle(SubmitShopBuyOrderCommand request,
CancellationToken cancellationToken)
{
//TODO: Implement your business logic
return new SubmitShopBuyOrderResponseDto();
var result = await _context.UserOrder.SubmitShopBuyOrderAsync(new SubmitShopBuyOrderRequest()
{
UserId = _currentUserService.UserId.Value,
TotalAmount = request.TotalAmount
}, cancellationToken: cancellationToken);
return result.Adapt<SubmitShopBuyOrderResponseDto>();
// return new SubmitShopBuyOrderResponseDto();
}
}
}

View File

@@ -1,3 +1,7 @@
using FrontOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
namespace FrontOffice.BFF.Application.UserOrderCQ.Commands.SubmitShopBuyOrder;
public class SubmitShopBuyOrderResponseDto
{