コード例 #1
0
 public ActionResult GetTODOs(int section = 1)
 {
     string userId = User.Identity.Name;
     var events = _repositoryTodoItem.Query.Where(c => c.UserId == userId && c.Done == false).OrderBy(c => c.StartTime > DateTime.Now).ThenBy(c => c.SortNum).ThenBy(c => c.PriorityId).ThenBy(c => c.StartTime).Take(section * SectionSize);
     var viewModel = new TODOlistViewModel
     {
         TodoItems = events,
         SectionInfo = new SectionInfo
         {
             CurrentSection = section,
             ItemsLoaded = events.Count(),
             TotalItems = _repositoryTodoItem.Query.Where(c => c.UserId == userId && c.Done == false).Count()
         }
     };
     ViewBag.Archive = false;
     return PartialView("_ListOfTodoItems", viewModel);
 }
コード例 #2
0
 public ActionResult GetArchive(int section = 1)
 {
     string userId = User.Identity.Name;
     var events = _repositoryTodoItem.Query.Where(c => c.UserId == userId && c.Done == true).OrderByDescending(c => c.TimeFinished).Take(section * SectionSize);
     var viewModel = new TODOlistViewModel
     {
         TodoItems = events,
         SectionInfo = new SectionInfo
         {
             CurrentSection = section,
             ItemsLoaded = events.Count(),
             TotalItems = _repositoryTodoItem.Query.Where(c => c.UserId == userId && c.Done == true).Count()
         }
     };
     ViewBag.Archive = true;
     return PartialView("_ListOfTodoItems", viewModel);
 }