Example #1
0
 public IQueryable<Task> GetByFilter(TaskFilter filter)
 {
     return _taskRepository.GetAll()
                           .Where(filter.TeacherFilter)
                           .Where(filter.GroupFilter)
                           .Where(filter.SubjectFilter)
                           .Where(filter.DateFilter);
     ;
 }
Example #2
0
        public ActionResult Index(TaskFilter filter)
        {
            var viewModel = new TaskListViewModel();
            viewModel.GroupID = (long?)filter.GroupID ?? 0;
            viewModel.SubjectID = (long?)filter.SubjectID ?? 0;
            viewModel.GroupSubjects = this._subjectManager
                                          .GetByGroup(filter.GroupID)
                                          .Select(SubjectMapper.ToViewModelExpression.Compile());

            filter.TeacherID = this.HttpContext.Cache.GetTeacherID();

            var tasks = this._taskManager.GetByFilter(filter);
            var identifiers = tasks.Select(x => x.TypeID);
            viewModel.Types = this._typeOfTaskManager.GetByIdentifiers(identifiers).Select(TypeOfTaskMapper.ToViewModelExpression);
            viewModel.Tasks = tasks.Select(TaskMapper.ToViewModelExpression);

            return View(viewModel);
        }