private void EditMovie(Movie movie) { var form = new MovieDetailForm(movie); var result = form.ShowDialog(this); if (result != DialogResult.OK) { return; } //Update the movie form.Movie.Id = movie.Id; _database.Update(form.Movie, out var message); if (!String.IsNullOrEmpty(message)) { MessageBox.Show(message); } RefreshUI(); }
private void OnProductAdd(object sender, EventArgs e) { var button = sender as ToolStripMenuItem; var form = new MovieDetailForm("Add Product"); //Show form modally var result = form.ShowDialog(this); if (result != DialogResult.OK) { return; } //Add to database _database.Add(form.Movie, out var message); if (!String.IsNullOrEmpty(message)) { MessageBox.Show(message); } RefreshUI(); }
private void EditMovie(Movie movie) { var form = new MovieDetailForm(movie); var result = form.ShowDialog(this); if (result != DialogResult.OK) { return; } //Update the movie form.Movie.Id = movie.Id; try { _database.Update(form.Movie); } catch (Exception e) { MessageBox.Show(e.Message); }; RefreshUI(); }