private async void OnSave(object sender, EventArgs e) { var valid = ValidateChildren(ValidationConstraints.Enabled); if (!valid) { return; } SaveBtn.Enabled = false; await _studentsService.CreateAsync(new CreateStudent { Id = PersonalIdTxt.Text, FullName = FullNameTxt.Text, FingerprintChecksum = _fingerPrintCheckSum, FingerprintImage = FingerprintPicture.Image.ToBytes(), Image = ImageBox.Image.ToBytes(), BirthDate = BirthDatePicker.Value }) .OnSuccess(() => MessageBoxWrapper.Info("Student created successfully")) .OnError(MessageBoxWrapper.Error); SaveBtn.Enabled = true; DialogResult = DialogResult.OK; Close(); }
private async void OnOkClick(object sender, EventArgs e) { var attendeeToAdd = (AddSeminarAttendeesListItemDto)_selectedSeminarAttendee.Tag; var dialogResult = MessageBoxWrapper.Confirmation($"Are you sure you want to register attendee {attendeeToAdd.Id} in seminar"); if (dialogResult != DialogResult.Yes) { return; } await _commandService.RegisterAttendeeAsync(new RegisterAttendeeAtSeminar { Id = _seminarId, AttendeeId = attendeeToAdd.Id }) .OnSuccess(() => MessageBoxWrapper.Info("Attendee registered successfully")) .OnError(_ => MessageBoxWrapper.Error("Attendee registration failed")); Close(); }
private async void OnAddSessionBtnClick(object sender, EventArgs e) { var valid = ValidateChildren(ValidationConstraints.Enabled); if (!valid) { return; } AddSessionBtn.Enabled = false; await _service.CreateAsync(new CreateSession { Id = Guid.NewGuid().ToString(), SeminarId = ((SessionsDropDownListItemDto)Sessions.SelectedItem).Id }) .OnSuccess(() => MessageBoxWrapper.Info("Session created successfully")) .OnError(MessageBoxWrapper.Error); AddSessionBtn.Enabled = true; DialogResult = DialogResult.OK; Close(); }