public async Task <IHttpActionResult> GetOrderHeader(int id)
        {
            //OrderHeader orderHeader = await db.OrderHeaders.FindAsync(id);
            //if (orderHeader == null)
            //{
            //    return NotFound();
            //}
            var orderHeader = await db.OrderHeaders
                              .Where(c => c.SalesOrderHeaderId == id)
                              .ToListAsync();

            //.FirstOrDefaultAsync();
            if (orderHeader == null)
            {
                return(NotFound());
            }


            int  InvoiceNum = 0;
            bool Facturado  = false;
            List <OrderSyncPhone> orderSyncPhonelist = new List <OrderSyncPhone>();

            foreach (var item in orderHeader)
            {
                if (item.OrderNum != 0)
                {
                    clsConexion objCon      = new clsConexion();
                    DataTable   dtInvcOrder = new DataTable();
                    //Obtenemos las ordenes sin enviar a Epicor
                    objCon.Connection = NutraBioticsBackend.Properties.Resources.ConexionEpicor;
                    string SQL = " Select OrderNum,InvoiceNum " +
                                 " from Erp.InvcHead" +
                                 " where OrderNum =" + item.OrderNum;
                    objCon.SQL  = SQL;
                    dtInvcOrder = objCon.ConsultarDT();
                    if (dtInvcOrder.Rows.Count > 0)
                    {
                        Facturado  = true;
                        InvoiceNum = Convert.ToInt32(dtInvcOrder.Rows[0]["InvoiceNum"]);
                    }
                    else
                    {
                        Facturado  = false;
                        InvoiceNum = 0;
                    }
                }
                else
                {
                    Facturado  = false;
                    InvoiceNum = 0;
                }

                OrderSyncPhone orderSyncPhone = new OrderSyncPhone();
                orderSyncPhone.SalesOrderHeaderInterId = item.SalesOrderHeaderId;
                orderSyncPhone.SalesOrderHeaderPhoneId = 0;//SalesOrderHeaderPhoneId;
                orderSyncPhone.OrderNum   = item.OrderNum;
                orderSyncPhone.TaxAmt     = item.TaxAmt;
                orderSyncPhone.Total      = item.Total;
                orderSyncPhone.Facturado  = Facturado;
                orderSyncPhone.InvoiceNum = InvoiceNum;
                orderSyncPhonelist.Add(orderSyncPhone);
            }

            return(Ok(orderSyncPhonelist));
        }