public ViewResult Index(string sortOrder, string currentFilter, string searchString, int?page) { ViewBag.CurrentSort = sortOrder; ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : ""; if (searchString != null) { page = 1; } else { searchString = currentFilter; } ViewBag.CurrentFilter = searchString; //var tasks = db.Tasks.Include(t => t.Project); var collectedThings = db.GetMyCollectedThings(User); orderBySortParam(ref collectedThings, sortOrder); int pageSize = 25; int pageNumber = (page ?? 1); //return View(tasks.ToPagedList(pageNumber, pageSize)); return(View(collectedThings.ToPagedList(pageNumber, pageSize))); }
// GET: /Review public ViewResult Review() { ReviewViewModel review = new ReviewViewModel(); //collected thins review.CollectedThings = new CollectedThingDateViewModel { HeaderTitle = "Collected Things", TableId = "collected-things", IconCssClass = "fa-plus-circle", RowsPerPage = 7, Items = db.GetMyCollectedThings(User).ToList() .Take(21).ToList() }; //inactive actions TimeSpan InactiveTimespanLimit = new TimeSpan(30, 0, 0, 0, 0); //30 days review.InactiveActions = new PomodoroContainerDateViewModel { HeaderTitle = "Inactive Actions", TableId = "inactive-actions", IconCssClass = "fa-stop", ReportTypeDate = ReportTypeDate.LastPomodoro, RowsPerPage = 7, Type = PomodoroContainerType.Action, Items = db.GetMyActions(User).ToList() .Where(a => a.IsActive && a.LastPomodoro != null && a.LastPomodoro.Start.HasValue && (DateTime.Today.Date.Subtract(a.LastPomodoro.StartLocal.Value) > InactiveTimespanLimit)) .Take(21).ToList() }; //expired actions review.ExpiredActions = new PomodoroContainerDateViewModel { HeaderTitle = "Expired Actions", TableId = "expired-actions", IconCssClass = "fa-calendar-o", ReportTypeDate = ReportTypeDate.NextDeadline, RowsPerPage = 3, Type = PomodoroContainerType.Action, Items = db.GetMyActions(User).ToList() .Where(a => a.IsExpired && a.IsActive).OrderBy(a => a.Deadline).ToList() .Take(15).ToList() }; //tasks with no active actions review.TaskWithNoActiveActions = new PomodoroContainerDateViewModel { HeaderTitle = "Task With No Active Actions", TableId = "tasks-no-active-actions", IconCssClass = "fa-dot-circle-o", ReportTypeDate = ReportTypeDate.LastPomodoro, RowsPerPage = 3, Type = PomodoroContainerType.Task, Items = db.GetMyTasks(User) .Where(t => t.Status == Status.Active && t.Project.Status == Status.Active && !db.Actions .Any(a => a.TaskID == t.ID && a.Status == Status.Active)).ToList() .OrderByDescending(t => (t.LastPomodoro != null ? t.LastPomodoro.Start : DateTime.MinValue)) .Take(15).ToList() }; //projects with no active tasks review.ProjectsWithNoActiveTasks = new PomodoroContainerDateViewModel { HeaderTitle = "Project With No Active Tasks", TableId = "projects-no-active-tasks", IconCssClass = "fa-bullseye", ReportTypeDate = ReportTypeDate.LastPomodoro, RowsPerPage = 3, Type = PomodoroContainerType.Project, Items = db.GetMyProjects(User) .Where(p => p.Status == Status.Active && !db.Tasks .Any(t => t.ProjectID == p.ID && t.Status == Status.Active)).ToList() .OrderByDescending(p => (p.LastPomodoro != null ? p.LastPomodoro.Start : DateTime.MinValue)) .Take(15).ToList() }; return(View(review)); }