Exemplo n.º 1
0
        public async Task <OrderSummeryViewModel> Handle(GetLatestOrderForBuyerQuery request, CancellationToken cancellationToken)
        {
            try
            {
                var orders = await OrderQueries.GetOrdersForBuyer(request.BuyerId);

                if (orders != null && orders.Count > 0)
                {
                    var latest = orders.First();
                    var diff   = DateTime.Now.Subtract(latest.date).Seconds;
                    if (diff < 60)
                    {
                        return(latest);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            return(null);
        }
        public async Task <List <OrderSummeryViewModel> > Handle(GetOrdersForBuyerQuery request, CancellationToken cancellationToken)
        {
            List <OrderSummeryViewModel> List = await OrderQueries.GetOrdersForBuyer(request.BuyerId);

            return(List);
        }