Exemplo n.º 1
0
        public async Task ValidateAsync(IOrderContainer orderContainer)
        {
            if (orderContainer == null)
            {
                throw new ArgumentNullException(nameof(orderContainer));
            }

            var order = await this.GetBy(orderContainer);

            if (orderContainer.OrderId.HasValue && order == null)
            {
                throw new InvalidOperationException($"Order not found by id {orderContainer.OrderId}");
            }
        }
Exemplo n.º 2
0
 public async Task <Order> GetByAsync(IOrderContainer order)
 {
     return(order.OrderId.HasValue
         ? this.Mapper.Map <Order>(await this.Context.Order.FirstOrDefaultAsync(x => x.Id == order.OrderId))
         : null);
 }
Exemplo n.º 3
0
 private Task <Order> GetBy(IOrderContainer orderContainer)
 {
     return(this.OrderDataAccess.GetByAsync(orderContainer));
 }