Merge branch 'newmain'
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
namespace FrontOffice.BFF.Application.UserOrderCQ.Commands.SubmitShopBuyOrder;
|
||||
public record SubmitShopBuyOrderCommand : IRequest<SubmitShopBuyOrderResponseDto>
|
||||
{
|
||||
//کل مبلغ قابل پرداخت
|
||||
public long TotalAmount { get; init; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace FrontOffice.BFF.Application.UserOrderCQ.Commands.SubmitShopBuyOrder;
|
||||
public class SubmitShopBuyOrderCommandHandler : IRequestHandler<SubmitShopBuyOrderCommand, SubmitShopBuyOrderResponseDto>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public SubmitShopBuyOrderCommandHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<SubmitShopBuyOrderResponseDto> Handle(SubmitShopBuyOrderCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
return new SubmitShopBuyOrderResponseDto();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace FrontOffice.BFF.Application.UserOrderCQ.Commands.SubmitShopBuyOrder;
|
||||
public class SubmitShopBuyOrderCommandValidator : AbstractValidator<SubmitShopBuyOrderCommand>
|
||||
{
|
||||
public SubmitShopBuyOrderCommandValidator()
|
||||
{
|
||||
RuleFor(model => model.TotalAmount)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<SubmitShopBuyOrderCommand>.CreateWithOptions((SubmitShopBuyOrderCommand)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
namespace FrontOffice.BFF.Application.UserOrderCQ.Commands.SubmitShopBuyOrder;
|
||||
public class SubmitShopBuyOrderResponseDto
|
||||
{
|
||||
//شناسه
|
||||
public long OrderId { get; set; }
|
||||
//
|
||||
public string PaymentStatus { get; set; }
|
||||
//
|
||||
public DateTime? Created { get; set; }
|
||||
//
|
||||
public string? PaymentMethod { get; set; }
|
||||
//
|
||||
public string? UserAddressText { get; set; }
|
||||
//
|
||||
public long? TotalAmount { get; set; }
|
||||
//
|
||||
public List<SubmitShopBuyOrderFactorDetail>? FactorDetails { get; set; }
|
||||
|
||||
}public class SubmitShopBuyOrderFactorDetail
|
||||
{
|
||||
//شناسه
|
||||
public long ProductId { get; set; }
|
||||
//
|
||||
public string ProductTitle { get; set; }
|
||||
//
|
||||
public string? ProductThumbnailPath { get; set; }
|
||||
//
|
||||
public long? UnitPrice { get; set; }
|
||||
//
|
||||
public int? Count { get; set; }
|
||||
//
|
||||
public long? UnitDiscountPrice { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user