public async Task CreateAsync(CreateLectureInputModel input) { Lecture lecture = new Lecture { Title = input.Title, StartDate = input.StartDate, EndDate = input.EndDate, CourseId = input.CourseId, }; await this.lecturesRepository.AddAsync(lecture); await this.lecturesRepository.SaveChangesAsync(); }
public async Task <IActionResult> Create(CreateLectureInputModel input, int id) { if (!this.ModelState.IsValid) { return(this.View(input)); } input.CourseId = id; await this.lecturesService.CreateAsync(input); this.TempData["Message"] = "Lecture created successfully!"; return(this.Redirect($"/Courses/ById/{id}")); }