protected void AddClick(object sender, EventArgs e) { var date = this.calendar.Value; if (date == null || date.Length == 0) { this.NoDate.Text = "No date selected!"; return; } else { this.NoDate.Text = ""; } var lectureDTO = new AddNewLectureDTO() { Title = this.LectureTitle.Text, TeacherId = Context.User.Identity.GetUserId(), StudentClassId = this.StudentClasses.SelectedValue, Date = this.calendar.Value, Start = this.StartTime.SelectedValue, End = this.EndTime.SelectedValue }; this.AddLectureClick?.Invoke(sender, new AddNewLectureEventArgs(lectureDTO)); if (this.Model.IsSuccess) { this.Message.ShowSuccess("Lecture added successfully."); } else { this.Message.ShowError(this.Model.ErrorMessage); } }
public AddNewLectureEventArgs(AddNewLectureDTO lectureDTO) { this.LectureDTO = lectureDTO; }