public void UpdateGenre(int id, string name, string description, DateTime date) { GenreBLL genreBLL = new GenreBLL(); Genre genre = new Genre(); genre.Id = id; genre.Name = name; genre.Description = description; genre.DateCreate = date; genreBLL.Update(genre); }
private void btnUpdate_Click(object sender, EventArgs e) { try { if (gv.ValidateGenre(txtGenreUpdate.Text.Trim())) { ge = new Genre(); ge.GenreId = int.Parse(txtGenreIDUpdate.Text); ge._Genre = txtGenreUpdate.Text.Trim(); ge.UpdBy = FormLoggedUser.Id; ge.isActive = booleanVariable; int error = genBLL.Update(ge); if (error == 0) { MessageBox.Show("Genre Updated Succesfully!"); this.Close(); } else { MessageBox.Show("Cannot update the specified Genre!"); } } else { throw new FormatException(); } } catch (FormatException) { MessageBox.Show("Genre is not valid"); } catch (Exception) { MessageBox.Show("Genre is not updated please contact your administrator"); } }