예제 #1
0
        private void InitTaskGrid(bool firstInit = true)
        {
            if (firstInit)
            {
                _displayedTaskTableItems = new List <TaskTableItem>();
                TasksGrid.ItemsSource    = _displayedTaskTableItems;
            }

            _displayedTaskTableItems.Clear();
            if (CertainSubjectTasks.IsChecked != null && (bool)CertainSubjectTasks.IsChecked)
            {
                if (AwailableSubjects.SelectedIndex == -1 && AwailableSubjects.Items.Count > 0)
                {
                    AwailableSubjects.SelectedIndex = 0;
                    return;
                }
                Subject selectedSubject = AwailableSubjects.SelectedItem as Subject;

                if (selectedSubject == null)
                {
                    return;
                }
                foreach (var task in _taskRepository.GetAllTasksBySubjectId(selectedSubject.SubjectId))
                {
                    _displayedTaskTableItems.Add(new TaskTableItem()
                    {
                        TaskTableItemTask    = task,
                        TaskTableItemSubject = _subjectRepository.GetSubjectById(task.SubjectId)
                    });
                }
                TasksGrid.Items.Refresh();
            }
            else
            {
                foreach (var task in _taskRepository.GetAllTasks())
                {
                    _displayedTaskTableItems.Add(new TaskTableItem()
                    {
                        TaskTableItemTask    = task,
                        TaskTableItemSubject = _subjectRepository.GetSubjectById(task.SubjectId)
                    });
                }
                TasksGrid.Items.Refresh();
            }
        }
예제 #2
0
 public Subject GetClassById(int id)
 {
     return(Repository.GetSubjectById(id));
 }
예제 #3
0
        public IActionResult SubjectAdd(int id)
        {
            Subject model = id == default ? new Subject() : subjectRepository.GetSubjectById(id);

            return(View(model));
        }