private void EditSelectedMovie() { var movie = GetSelectedMovie(); if (movie == null) { return; } var form = new MovieDetailForm(movie); if (form.ShowDialog(this) == DialogResult.Cancel) { return; } //update product form.Movie.Id = movie.Id; _database.Update(form.Movie, out var message); if (!String.IsNullOrEmpty(message)) { MessageBox.Show(message); EditSelectedMovie(); } RefreshUI(); }
private void EditSelectedMovie() { var movie = GetSelectedMovie(); if (movie == null) { return; } var form = new MovieDetailForm(movie); if (form.ShowDialog(this) != DialogResult.OK) { return; } //update product form.Movie.Id = movie.Id; try { _database.Update(form.Movie); } catch (Exception ex) { MessageBox.Show(ex.Message); EditSelectedMovie(); } RefreshUI(); }
private void OnMovieAdd(object sender, EventArgs e) { var form = new MovieDetailForm(); form.Text = "Add Movie"; if (form.ShowDialog(this) != DialogResult.OK) { return; } _movie = form.Movie; }
private void OnMovieAdd(object sender, EventArgs e) { var form = new MovieDetailForm("Add Movie"); if (form.ShowDialog(this) != DialogResult.OK) { return; } _database.Add(form.Movie); //if (!String.IsNullOrEmpty(message)) // MessageBox.Show(message); RefreshUI(); }
private void OnMovieAdd(object sender, EventArgs e) { var form = new MovieDetailForm("Add Movie"); if (form.ShowDialog(this) == DialogResult.Cancel) { return; } _database.Add(form.Movie, out var message); if (!String.IsNullOrEmpty(message)) { MessageBox.Show(message); OnMovieAdd(sender, e); } RefreshUI(); }
private void OnMovieEdit(object sender, EventArgs e) { var form = new MovieDetailForm(); if (_movie == null) { MessageBox.Show(this, "No Movie to edit"); return; } form.Text = "Edit Movie"; form.Movie = _movie; if (form.ShowDialog(this) == DialogResult.OK) { _movie = form.Movie; } }