Ejemplo n.º 1
0
        public async void getNoticiasCaracolEconomia(Inoticias intnoticas)
        {
            HttpResponseMessage rta = await cliente.GetAsync(new Uri(URL_CARACOLECONOMIA));

            String xml = rta.Content.ToString();

            document = XDocument.Parse(xml);
            List <Noticia> noticia  = new List <Noticia>();
            Noticia        temp     = new Noticia();
            XElement       rss      = document.Element("rss");
            XElement       channel2 = rss.Element("channel");

            for (int i = 0; i < 10; i++)
            {
                XElement item = channel2.Element("item");
                channel2.Element("item").Remove();
                temp.Descripcion = item.Element("description").Value;
                temp.Titulo      = item.Element("title").Value;
                temp.Fecha       = item.Element("pubDate").Value;
                temp.Categoria   = "Todas";
                noticia.Add(temp);
            }
            intnoticas.getNoticias(noticia);
        }
 public void updateNoticia(Noticia noticia)
 {
     con.Update(noticia);
 }
 public void deleteNoticia(Noticia noticia)
 {
     con.Delete(noticia);
 }
 public void insertNoticia(Noticia noticia)
 {
     con.Insert(noticia);
 }