コード例 #1
0
        public ActionResult MarkTaskList(MarkTaskListModel model, MarkTaskListPagingFilteringModel command)
        {
            if (command.PageNumber <= 0)
            {
                command.PageNumber = 1;
            }
            if (null == model)
            {
                model = new MarkTaskListModel();
            }
            var subject = _subjectService.GetSubjectList();

            model.SubjectList.Add(new SelectListItem()
            {
                Text = "请选择", Value = string.Empty
            });
            subject.ToSelectItems().ForEach(t => model.SubjectList.Add(t));
            if (_workContext.CurrentCustomer.IsAdmin())
            {
                var bookTasks = _bookWorkTaskService.GetAllTasks(taskStatus: TaskStatus.Mark, subjectId: model.SubjectId,
                                                                 pageIndex: command.PageNumber - 1, pageSize: command.PageSize);
                model.BookWorkTaskList = bookTasks;
                model.PagingFilteringContext.LoadPagedList(bookTasks);
            }
            else
            {
                var bookTasks = _bookWorkTaskService.GetAllTasks(_workContext.CurrentCustomer.Id, TaskStatus.Mark,
                                                                 model.SubjectId, command.PageNumber - 1, command.PageSize);
                model.BookWorkTaskList = bookTasks;
                model.PagingFilteringContext.LoadPagedList(bookTasks);
            }

            return(View(model));
        }
コード例 #2
0
 public MarkTaskListModel()
 {
     PagingFilteringContext = new MarkTaskListPagingFilteringModel();
     SubjectList            = new List <SelectListItem>();
 }