public ActionResult PersonalizedHtmlTable(int page = 1) { CategoryPersonalizer personalize = new CategoryPersonalizer(context); var username = Session["username"].ToString(); var request = NewsRequest.Construct(username, context); IQueryable<NewsFile> articles = personalize.GetNews(request).OrderByDescending(x => x.PubDate); var items = articles.ToList(); return View(items.ToPagedList(page, 25)); }
public ActionResult GetNew(DateTime firstDate, String token, Coordinates location = null) { CategoryPersonalizer personalize = new CategoryPersonalizer(context); IQueryable<NewsFile> articles; var request = NewsRequest.Construct(Guid.Parse(token), context, location); firstDate.AddSeconds(1); articles = personalize.GetNews(request).OrderByDescending(x => x.PubDate); articles = articles.Where(x => x.PubDate > firstDate); return new FeedResult(listToRss(articles.ToList(), personalize.Messages)); }
public ActionResult Index(int page = 1) { CategoryPersonalizer personalize = new CategoryPersonalizer(context); var userName = Session["username"].ToString(); var user = context.Users.Where(x => x.Username == userName).First(); var request = NewsRequest.Construct(userName, context); IQueryable<NewsFile> articles = personalize.GetNews(request).OrderByDescending(x => x.PubDate); var items = articles; return View(new RssHtmlModelView { includedCategories = items.Select(x => x.Category).GroupBy(x => x.CategoryId).Select(x => x.FirstOrDefault()).ToList(), newsFiles = items.Take(30).ToList(), FilterMessages = personalize.Messages, user = user }); }
// // GET: /Feed/ public ActionResult Index(DateTime? lastDate, String token = null, Coordinates location = null) { CategoryPersonalizer personalize = new CategoryPersonalizer(context); IQueryable<NewsFile> articles; if (token == null) { articles = context.NewsFiles.OrderByDescending(pub => pub.PubDate); } else { var request = NewsRequest.Construct(Guid.Parse(token), context, location); articles = personalize.GetNews(request).OrderByDescending(x => x.PubDate); } if (lastDate != null) { articles = articles.Where(x => x.PubDate < lastDate); } return new FeedResult(listToRss(articles.Take(15).ToList(), personalize.Messages)); }
// // GET: /Feed/ public ActionResult IndexHtml(int userId, int page = 1) { CategoryPersonalizer personalize = new CategoryPersonalizer(context); IQueryable<NewsFile> articles; var request = NewsRequest.Construct(userId, context); articles = personalize.GetNews(request).OrderByDescending(x => x.PubDate); var items = articles; return View("Index", new RssHtmlModelView { includedCategories = items.Select(x => x.Category).GroupBy(x => x.CategoryId).Select(x => x.FirstOrDefault()).ToList(), newsFiles = items.Take(30).ToList(), FilterMessages = personalize.Messages }); }
public ActionResult PersonalizedHtmlTable(int id, int page = 1) { CategoryPersonalizer personalize = new CategoryPersonalizer(context); var request = NewsRequest.Construct(id, context); IQueryable<NewsFile> articles = personalize.GetNews(request).OrderByDescending(x => x.PubDate); var items = articles.ToList(); return View("~/Views/NewsFiles/Index.cshtml", items.ToPagedList(page, 25)); }