Exemplo n.º 1
0
        public static AddedOrderDto ToAddedOrderDto(this Order dto)
        {
            var result = new AddedOrderDto()
            {
                OrderDate = dto.OrderDate.ToString(),
                Remark    = dto.Remark,
            };

            result.Items.AddRange(dto.OrderItems.ToOrderItemDtos());

            return(result);
        }
Exemplo n.º 2
0
        public async override Task <OrderDto> Add(AddedOrderDto request, ServerCallContext context)
        {
            var order = await _orderApplication.AddOrderAsync(request.ToOrder());

            return(order.ToOrderDto());
        }
Exemplo n.º 3
0
 public static Order ToOrder(this AddedOrderDto dto)
 {
     DateTime.TryParse(dto.OrderDate, out DateTime orderDate);
     return(new Order(string.Empty, orderDate, dto.Remark, dto.Items.ToOrderItems()));
 }