示例#1
0
 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();
     }
 }
示例#2
0
        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();
            }
        }
示例#3
0
 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();
     }
 }
示例#4
0
        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();
            }
        }
示例#5
0
 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();
     }
 }