private void AlbumList_Load(object sender, EventArgs e) { using (var db = new VinylDBContext()) { grdAlbums.DataSource = (from a in db.Albums orderby a.Name select a).ToList(); } }
public void SaveData() { Artist oArtist = new Artist(); oArtist.ArtistName = txtArtist.Text; oArtist.Description = txtBioInfo.Text; oArtist.Genre = txtGenre.Text; oArtist.LastUpdate = DateTime.Now; using (VinylDBContext db = new VinylDBContext()) { db.Artists.Add(oArtist); db.SaveChanges(); } }
private void AlbumEdit_Load(object sender, EventArgs e) { using (var db = new Puce.Models.VinylDBContext()) { ddlArtist.DataSource = (from u in db.Artists orderby u.ArtistName select new ArtistDropDownDisplay { ArtistName = u.ArtistName, ArtistId = u.ArtistID }).ToList(); } }
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(); } }
private void AlbumList_Load(object sender, EventArgs e) { using (VinylDBContext db = new VinylDBContext()) { grdArtist.DataSource = (from a in db.Artists orderby a.ArtistName select new ArtistListDisplay { ArtistID = a.ArtistID, ArtistName = a.ArtistName, Description = a.Description, Genre = a.Genre, LastUpdate = a.LastUpdate }).ToList(); } }