Example #1
0
        public GetAllOrdersOut GetAllOrders(GetAllOrdersIn input)
        {
            GetAllOrdersOut response = new GetAllOrdersOut()
            {
                ResponseCode = Entities.Client.General.ResponseCode.Error
            };

            using (IDbConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                DynamicParameters param = new DynamicParameters();


                var data = connection.Query <Order>("SELECT [OrderId] , c.FirstName + ' ' + c.LastName [ClientName], c.ClientId ,[PurchaseDate] ,[Total] FROM tbl_Order o INNER JOIN tbl_Client c ON o.ClientId = c.ClientId ORDER BY PurchaseDate DESC");

                var orderList = new List <Order>();

                foreach (var i in data)
                {
                    var order = new Order()
                    {
                        OrderId      = i.OrderId,
                        ClientId     = i.ClientId,
                        ClientName   = i.ClientName,
                        Total        = i.Total,
                        PurchaseDate = i.PurchaseDate,
                    };

                    orderList.Add(order);
                }

                response.order = orderList;

                if (response.order.Count > 0)
                {
                    response.ResponseCode = Entities.Client.General.ResponseCode.Success;
                }
            }

            return(response);
        }
        public IHttpActionResult GetAllOrders(GetAllOrdersIn input)
        {
            var response = client.GetAllOrders(input);

            return(Ok(response));
        }
Example #3
0
 public GetAllOrdersOut GetAllOrders(GetAllOrdersIn input)
 {
     return(orderDA.GetAllOrders(input));
 }