Example #1
0
        public async Task <IActionResult> Create(CreateLessonBindingModel model)
        {
            await this.lessonsService.CreateAsync(model);

            this.TempData[NotificationsConstants.SuccessNotification] = NotificationsConstants.SuccessfullyAddedLesson;
            return(this.RedirectToAction("index"));
        }
Example #2
0
        public async Task <int> CreateAsync(CreateLessonBindingModel model)
        {
            Lesson lesson = new Lesson();

            lesson.Name             = model.Name;
            lesson.Hours            = model.Hours;
            lesson.IsOnline         = model.IsOnline;
            lesson.PresentationDate = model.PresentationDate;
            lesson.Seats            = model.Seats;
            lesson.SubjectId        = model.SubjectId;

            await this.dbContext.Lessons.AddAsync(lesson);

            await this.dbContext.SaveChangesAsync();

            return(lesson.Id);
        }