public void SaveData() { Album oAlbum = new Album(); oAlbum.Name = txtAlbumName.Text; oAlbum.ArtistID = (ddlArtist.SelectedValue as ArtistDropDownDisplay).ArtistId; oAlbum.LastUpdate = DateTime.Now; oAlbum.Quantity = 1; oAlbum.ReleaseDate = dtpReleaseDate.Value; using (VinylDBContext db = new VinylDBContext()) { db.Albums.Add(oAlbum); db.SaveChanges(); } }
public void SetupData(Album p_oAlbum) { txtAlbumName.Text = p_oAlbum.Name; dtpReleaseDate.Value = p_oAlbum.ReleaseDate.Value; ddlArtist.SelectedValue = p_oAlbum.Artist; }
public AlbumEdit(Album p_oAlbum) { SetupData(p_oAlbum); }