public ScheduleSubject ToCore(ScheduleSubjectModel obj) => new ScheduleSubject
 {
     Id         = obj.Id,
     Hall       = obj.Hall,
     IsPeriodic = obj.IsPeriodic,
     StartTime  = obj.StartTime,
     WeekDays   = _weekDaysMapper.ToCore(obj.WeekDays),
     GroupId    = obj.GroupId
 };
예제 #2
0
        /// <summary>
        /// Обрабатывает событие, в зависимости от статуса ViewModel.
        /// </summary>
        private void HandleAction(object o)
        {
            switch (CurrentState)
            {
            case ItemsListEditState.NoSelected:
            {
                Model        = new TModel();
                CurrentState = ItemsListEditState.Creating;
                break;
            }

            case ItemsListEditState.Selected:
            {
                CurrentState = ItemsListEditState.Editing;
                break;
            }

            case ItemsListEditState.Creating:
            {
                BeforeCreate();
                BeforeSave();
                _searchableRepository.Add(_entityMapper.ToCore(Model));
                ItemsListViewModel.Refresh();
                CurrentState = ItemsListEditState.NoSelected;
                break;
            }

            case ItemsListEditState.Editing:
            {
                BeforeSave();
                _searchableRepository.Update(_entityMapper.ToCore(Model));
                ItemsListViewModel.Refresh();
                CurrentState = ItemsListEditState.NoSelected;
                break;
            }
            }
        }
예제 #3
0
        /// <summary>
        /// Меняет текущий день недели.
        /// </summary>
        /// <param name="weekDay">День недели.</param>
        private void WeekDaySelect(WeekDayModel weekDay)
        {
            if (weekDay == WeekDayModel.Undefined)
            {
                return;
            }

            if (weekDay != _selectedWeekDay)
            {
                _selectedWeekDay = weekDay;

                // Обновляем расписание.
                ScheduleSubject[]          schedueItems = _scheduleRepository.GetSchedulePerWeekDay(_weekDaysMapper.ToCore(weekDay));
                ScheduleSubjectItemModel[] items        = schedueItems.Select(x => _scheduleItemsMapper.ToModel(x)).OrderBy(x => x.Item.StartTime).ToArray();
                SetScheduleItems(items);
            }
        }