2017-01-25 17:10:08 +01:00
|
|
|
|
using System;
|
|
|
|
|
using MediatR;
|
|
|
|
|
using System.Collections.Generic;
|
2016-12-29 11:03:03 +01:00
|
|
|
|
|
2017-01-25 17:10:08 +01:00
|
|
|
|
namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands
|
|
|
|
|
{
|
|
|
|
|
|
2017-01-17 18:32:40 -08:00
|
|
|
|
|
2017-01-18 16:51:44 -08:00
|
|
|
|
public class CreateOrderCommand
|
2016-12-29 11:03:03 +01:00
|
|
|
|
:IAsyncRequest<bool>
|
|
|
|
|
{
|
2017-01-25 17:10:08 +01:00
|
|
|
|
private readonly List<OrderItemDTO> _orderItems;
|
|
|
|
|
|
2016-12-29 11:03:03 +01:00
|
|
|
|
public string City { get; set; }
|
|
|
|
|
|
|
|
|
|
public string Street { get; set; }
|
|
|
|
|
|
|
|
|
|
public string State { get; set; }
|
|
|
|
|
|
|
|
|
|
public string Country { get; set; }
|
|
|
|
|
|
|
|
|
|
public string ZipCode { get; set; }
|
|
|
|
|
|
|
|
|
|
public string CardNumber { get; set; }
|
|
|
|
|
|
|
|
|
|
public string CardHolderName { get; set; }
|
|
|
|
|
|
|
|
|
|
public DateTime CardExpiration { get; set; }
|
|
|
|
|
|
|
|
|
|
public string CardSecurityNumber { get; set; }
|
|
|
|
|
|
|
|
|
|
public int CardTypeId { get; set; }
|
|
|
|
|
|
2017-01-25 17:10:08 +01:00
|
|
|
|
public string BuyerFullName { get; set; }
|
2016-12-29 11:03:03 +01:00
|
|
|
|
|
2017-01-30 15:46:43 +01:00
|
|
|
|
public IEnumerable<OrderItemDTO> OrderItems => _orderItems;
|
2016-12-29 11:03:03 +01:00
|
|
|
|
|
2017-01-25 17:10:08 +01:00
|
|
|
|
public void AddOrderItem(OrderItemDTO item)
|
2016-12-29 11:03:03 +01:00
|
|
|
|
{
|
|
|
|
|
_orderItems.Add(item);
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-18 16:51:44 -08:00
|
|
|
|
public CreateOrderCommand()
|
2016-12-29 11:03:03 +01:00
|
|
|
|
{
|
2017-01-25 17:10:08 +01:00
|
|
|
|
_orderItems = new List<OrderItemDTO>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class OrderItemDTO
|
|
|
|
|
{
|
|
|
|
|
public int ProductId { get; set; }
|
|
|
|
|
|
|
|
|
|
public string ProductName { get; set; }
|
|
|
|
|
|
|
|
|
|
public decimal UnitPrice { get; set; }
|
|
|
|
|
|
|
|
|
|
public decimal Discount { get; set; }
|
|
|
|
|
|
|
|
|
|
public int Units { get; set; }
|
2017-01-30 15:46:43 +01:00
|
|
|
|
|
|
|
|
|
public string PictureUrl { get; set; }
|
2016-12-29 11:03:03 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|