43 lines
1021 B
C#
43 lines
1021 B
C#
// EN: Command to create a new order.
|
|
// VI: Command tạo order mới.
|
|
|
|
using MediatR;
|
|
|
|
namespace OrderService.API.Application.Commands;
|
|
|
|
/// <summary>
|
|
/// EN: Command to create a new order with validation through strategies.
|
|
/// VI: Command tạo order mới với validation qua strategies.
|
|
/// </summary>
|
|
public record CreateOrderCommand(
|
|
Guid ShopId,
|
|
Guid? CustomerId,
|
|
List<OrderItemRequest> Items,
|
|
decimal? DiscountAmount = null,
|
|
string? DiscountType = null,
|
|
string? DiscountReference = null,
|
|
Guid? TableId = null
|
|
) : IRequest<CreateOrderResult>;
|
|
|
|
/// <summary>
|
|
/// EN: Order item request.
|
|
/// VI: Yêu cầu order item.
|
|
/// </summary>
|
|
public record OrderItemRequest(
|
|
Guid ProductId,
|
|
string ProductName,
|
|
string ProductType,
|
|
int Quantity,
|
|
decimal UnitPrice
|
|
);
|
|
|
|
/// <summary>
|
|
/// EN: Result of create order command.
|
|
/// VI: Kết quả command tạo order.
|
|
/// </summary>
|
|
public record CreateOrderResult(
|
|
Guid OrderId,
|
|
decimal TotalAmount,
|
|
string Status
|
|
);
|