public ActionResult RecentUploads() { var files = new List <ServerFile>(); var recentUploadsCutoffDate = DateTime.Today.AddDays(-30); using (var context = new HickoryPTAApp.Models.HickoryPTAAppContext()) { IQueryable <ServerFile> query = context.ServerFiles; files.AddRange( query .Where(p => p.LastModified >= recentUploadsCutoffDate) .OrderByDescending(p => p.LastModified) .Take(20) .ToList()); } return(FilesPartialView(files, "New Files")); }
public ActionResult Events() { var events = new List <CommitteeEvent>(); using (var context = new HickoryPTAApp.Models.HickoryPTAAppContext()) { IQueryable <CommitteeEvent> query = context.CommitteeEvents; events.AddRange( query .Include(e => e.Committee) .Include(e => e.Location) .OrderBy(e => e.EventDate) .Where(e => e.EventDate >= DateTime.Today) .Take(10) .ToList()); } return(PartialView("_EventsPartial", events)); }
public ActionResult BreakingNews() { var posts = new List <CommitteePost>(); var breakingNewsCutoffDate = DateTime.Today.AddDays(-10); using (var context = new HickoryPTAApp.Models.HickoryPTAAppContext()) { IQueryable <CommitteePost> query = context.CommitteePosts; posts.AddRange( query .Include(p => p.Committee) .Include(p => p.Files) .Where(p => p.LastModified >= breakingNewsCutoffDate) .OrderByDescending(p => p.LastModified) .ToList()); } return(PartialView("_BreakingNewsPartial", posts)); }