Exemple #1
0
        private async Task Save()
        {
            this.Lesson.Date        = this.LessonDate;
            this.Lesson.Description = this.Description;
            this.Lesson.Group       = this.IsGroupsAvailable ? this.SelectedGroup : null;
            this.Lesson.Stream      = this.SelectedStream;
            this.Lesson.LessonType  = this.SelectedLessonType.Type;
            this.Lesson.Schedule    = this.SelectedSchedule;
            if (!this.IsGroupsAvailable)
            {
                this.Lesson.Group = null;
            }
            _originalEntity.Apply(this.Lesson);
            _db.SetLessonOrder(_originalEntity);
            if (this.Lesson.Id == default)
            {
                _originalEntity.CreationDate = DateTime.Now;
                _db.Lessons.Add(_originalEntity);
            }

            await _db.SaveChangesAsync();

            if (!this.SetAllPresent)
            {
                return;
            }

            await RegisterAllStudents(_originalEntity);
        }