public void OnNavigatedTo(INavigationParameters parameters)
        {
            if (parameters.ContainsKey("Selected_tbl_NewsCategory"))
            {
                Selected_tbl_NewsCategory = (tbl_NewsCategory)parameters["Selected_tbl_NewsCategory"];

                GetNewArticles(Selected_tbl_NewsCategory.pk);
            }
        }
Пример #2
0
        public ActionResult PostFeed(string type)
        {
            tbl_NewsCategory category = db.tbl_NewsCategories.Where(s => s.Alias.Contains(type)).FirstOrDefault();

            if (category == null)
            {
                return(HttpNotFound());
            }
            IEnumerable <tbl_Article> posts = (from s in db.tbl_Articles where s.Alias.Contains(type) select s).ToList();
            var feed  = new SyndicationFeed(category.Name, "RSS Feed", new Uri("http://vnexpress.net/rss"), Guid.NewGuid().ToString(), DateTime.Now);
            var items = new List <SyndicationItem>();

            foreach (tbl_Article art in posts)
            {
                string postUrl = String.Format("http://vnexpress.net/" + art.Alias + "{-0}", art.Id);
                var    item    = new SyndicationItem(Helper.RemoveIllegalCharacters(art.Title), Helper.RemoveIllegalCharacters(art.Decription), new Uri(postUrl), art.Id.ToString(), art.DatePublished.Value);
                items.Add(item);
            }
            feed.Items = items;
            return(new RSSActionResult {
                Feed = feed
            });
        }