Generator Changes at 9/27/2025 10:36:00 AM
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
namespace FrontOffice.BFF.Application.UserOrderCQ.Commands.CreateNewUserOrder;
|
||||
public record CreateNewUserOrderCommand : IRequest<CreateNewUserOrderResponseDto>
|
||||
{
|
||||
//قیمت
|
||||
public long Price { get; init; }
|
||||
//شناسه پکیج
|
||||
public long PackageId { get; init; }
|
||||
//شناسه تراکنش
|
||||
public long? TransactionId { get; init; }
|
||||
//وضعیت پرداخت
|
||||
public bool PaymentStatus { get; init; }
|
||||
//تاریخ پرداخت
|
||||
public DateTime? PaymentDate { get; init; }
|
||||
//شناسه کاربر
|
||||
public long UserId { get; init; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace FrontOffice.BFF.Application.UserOrderCQ.Commands.CreateNewUserOrder;
|
||||
public class CreateNewUserOrderCommandHandler : IRequestHandler<CreateNewUserOrderCommand, CreateNewUserOrderResponseDto>
|
||||
{
|
||||
private readonly IApplicationContractContext _context;
|
||||
|
||||
public CreateNewUserOrderCommandHandler(IApplicationContractContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public async Task<CreateNewUserOrderResponseDto> Handle(CreateNewUserOrderCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
//TODO: Implement your business logic
|
||||
return new CreateNewUserOrderResponseDto();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace FrontOffice.BFF.Application.UserOrderCQ.Commands.CreateNewUserOrder;
|
||||
public class CreateNewUserOrderCommandValidator : AbstractValidator<CreateNewUserOrderCommand>
|
||||
{
|
||||
public CreateNewUserOrderCommandValidator()
|
||||
{
|
||||
RuleFor(model => model.Price)
|
||||
.NotNull();
|
||||
RuleFor(model => model.PackageId)
|
||||
.NotNull();
|
||||
RuleFor(model => model.PaymentStatus)
|
||||
.NotNull();
|
||||
RuleFor(model => model.UserId)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<CreateNewUserOrderCommand>.CreateWithOptions((CreateNewUserOrderCommand)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace FrontOffice.BFF.Application.UserOrderCQ.Commands.CreateNewUserOrder;
|
||||
public class CreateNewUserOrderResponseDto
|
||||
{
|
||||
//شناسه
|
||||
public long Id { get; set; }
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user