// // GET: /RSS/ public ActionResult RSSIndex() { int userid = (int)Session["userid"]; RSSUser user = Db.users.Where(c => c.Id == userid).FirstOrDefault(); parser Pars = new parser(); if (user != null) { user.subscriptions = Db.channels.Where(c => c.userId == user.Id).ToList(); user.currentChannel = Db.channels.Where(c => c.isCurrent == true).FirstOrDefault(); user.categories = Db.categories.Where(c => c.userId == user.Id).ToList(); user.currentCategory = Db.categories.Where(c => c.isCurrent == true).FirstOrDefault(); } Pars.channels = user.subscriptions; if (user.currentChannel != null) { //user.currentChannel.item = Db.articles.Where(a => a.channelId == user.currentChannel.id).ToList(); if (user.currentChannel.item.Count == 0) { Pars.parseOneFeed(user.currentChannel.title); channel ch = Pars.channels.Where(c => c.title == user.currentChannel.title).FirstOrDefault(); if (ch != null) { user.currentChannel.item = ch.item; } user.currentArticle = (string)Session["currentarticle"]; } } if (user.currentChannel == null) { user.currentChannel = new channel(); } return(View("RSSIndex", user)); }
// // GET: /RSS/ public ActionResult RSSIndex() { int userid = (int)Session["userid"]; RSSUser user = Db.users.Where(c => c.Id == userid).FirstOrDefault(); parser Pars = new parser(); if (user != null) { user.subscriptions = Db.channels.Where(c => c.userId == user.Id).ToList(); user.currentChannel = Db.channels.Where(c => c.isCurrent == true).FirstOrDefault(); user.categories = Db.categories.Where(c => c.userId == user.Id).ToList(); user.currentCategory = Db.categories.Where(c => c.isCurrent == true).FirstOrDefault(); } Pars.channels = user.subscriptions; if (user.currentChannel != null) { //user.currentChannel.item = Db.articles.Where(a => a.channelId == user.currentChannel.id).ToList(); if (user.currentChannel.item.Count == 0) { Pars.parseOneFeed(user.currentChannel.title); channel ch = Pars.channels.Where(c => c.title == user.currentChannel.title).FirstOrDefault(); if (ch != null) { user.currentChannel.item = ch.item; } user.currentArticle = (string)Session["currentarticle"]; } } if (user.currentChannel == null) { user.currentChannel = new channel(); } return View("RSSIndex", user); }