public void GetQuote(String symbol)
 {
     Dictionary<String, String> data = new Dictionary<string, string>();
     data.Add("symbol", symbol);
     contodb c = new contodb();
     //c.insertToQuoteTable(data);
 }
 public IHttpActionResult InsertQuote(HttpRequestMessage request)
 {
     
     Debug.WriteLine(request.Content.ReadAsStringAsync().Result);
     Dictionary<String, String> data = new Dictionary<string, string>();
     //data.Add("symbol", symbol);
     contodb c = new contodb();
     //c.insertToQuoteTable(data);
     return Ok();
 }
 public IHttpActionResult DeleteQuote(String symbol)
 {
     contodb c = new contodb();
     if (c.DeleteQuote(symbol))
     {
         return Ok();
     }
     else
     {
         return null;
     }
     
 }
        /*
        // POST api/<controller>
        public String Post([FromBody]string value)
        {
            Debug.WriteLine("post: " + value);
            return "post: " + value;
        }
        */
        public String Post(myUrlApiDataSource data)
        {
            List<Dictionary<String, String>> nodeDicList = new List<Dictionary<string, string>>();
            String url = data.url;
            url = url.Replace("json", "xml");
            url = url.Replace("csv", "xml");
            WebRequest request = WebRequest.Create(url);
            // Create a request for the URL. 
            // If required by the server, set the credentials.
            request.Credentials = CredentialCache.DefaultCredentials;
            // Get the response.
            WebResponse response = request.GetResponse();
            // Display the status.
            Console.WriteLine(((HttpWebResponse)response).StatusDescription);
            // Get the stream containing content returned by the server.
            Stream dataStream = response.GetResponseStream();
            // Open the stream using a StreamReader for easy access.
            StreamReader reader = new StreamReader(dataStream);
            // Read the content.
            string responseFromServer = reader.ReadToEnd();
            // Display the content.
            //Debug.WriteLine(responseFromServer);

            // Clean up the streams and the response.
            reader.Close();
            response.Close();

            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(responseFromServer);

            // returns the number of items in the xml file
            int items = xmlDoc.GetElementsByTagName("item").Count;

            XmlNodeList nodeList = xmlDoc.GetElementsByTagName("item");
            string Short_Fall = string.Empty;
            foreach (XmlNode node in nodeList)
            {
                Dictionary<String, String> nodeDic = new Dictionary<string, string>();
                //Debug.WriteLine(Short_Fall = node.InnerText);
                for (int i=0; i<node.ChildNodes.Count; i++)
                {
                    //Debug.WriteLine("-- " + node.ChildNodes.Item(i).Name);
                    if (node.ChildNodes.Item(i).InnerText != "")
                    {
                        nodeDic.Add(node.ChildNodes.Item(i).Name, node.ChildNodes.Item(i).InnerText);
                        //Debug.WriteLine( node.ChildNodes.Item(i).Name);
                    }
                }

                nodeDicList.Add(nodeDic);
                //Debug.WriteLine(Short_Fall = node.InnerXml);
            }

            contodb c = new contodb();
            c.insertToQuoteTable(nodeDicList);

            //Debug.WriteLine(data.ToString());
            Debug.WriteLine("post: - " + data.url);
            return "post: " + data.url;
        }
 public IEnumerable<Product> GetAllQuotes()
 {
     contodb c = new contodb();
     List<Product> products = c.dothis();
     return products.ToArray();
 }