private async void btnSubmit_Click(object sender, EventArgs e) { if (this.ValidateChildren()) { GenreUpsertRequest request = new GenreUpsertRequest() { GenreName = txtGenreName.Text, GenreDescription = txtGenreDesc.Text }; if (_genreId.HasValue) { await _genreService.Update <Model.Genre>(_genreId, request); } else { await _genreService.Insert <Model.Genre>(request); } refreshHandler?.Invoke(this, null); MessageBox.Show("Task successful"); } }
private async void btnSave_Click(object sender, EventArgs e) { if (ValidateChildren()) { var request = new GenreUpsertRequest { Name = txtName.Text }; if (_ID.HasValue) { await genreService.Update <MGenre>(_ID.Value, request); MessageBox.Show("Genre updated successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { await genreService.Insert <MGenre>(request); MessageBox.Show("Genre added successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } PanelHelper.SwapPanels(this.Parent, this, new GenreList()); } }