Exemplo n.º 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();
     }
 }
Exemplo n.º 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();
            }
        }
Exemplo n.º 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();
     }
 }
Exemplo n.º 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();
            }
        }
Exemplo n.º 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();
     }
 }