private void BtnAddArtist_Click(object sender, EventArgs e) { if (ArtistTxtBox.Text == "") { MessageHelper.PromptErrorMsg(MessageTypeEnum.NullArtist); } else { ArtistModel artist = new ArtistModel() { Name = ArtistTxtBox.Text }; bool createSuccessful = this.artistService.Create(artist); if (createSuccessful) { GetArtistList(); ArtistsListBox.SelectedIndex = ArtistsListBox.Items.Count - 1; } else { ArtistTxtBox.SelectAll(); ArtistTxtBox.Focus(); } } }
private void BtnArtistEdit_MouseClick(object sender, MouseEventArgs e) { if (ArtistTxtBox.Text == "") { MessageHelper.PromptErrorMsg(MessageTypeEnum.NullArtist); } else { ArtistModel artist = Store.Artists.SingleOrDefault(a => a.Id == Store.ArtistId); bool updateSucessful = artistService.Update(artist); if (updateSucessful) { GetArtistList(); ArtistsListBox.SelectedIndex = Store.Artists.IndexOf(artist); } else { ArtistTxtBox.SelectAll(); ArtistTxtBox.Focus(); } } }