Exemple #1
0
        private void addTag_Click(object sender, RoutedEventArgs e)
        {
            ApplicationDBEntities1 db = new ApplicationDBEntities1();
            Tag tagObject             = new Tag()
            {
                tagName = tag_name.Text,
            };

            db.Tags.Add(tagObject);
            db.SaveChanges();
            this.loadTags();
        }
Exemple #2
0
        private void addAalbum_Click(object sender, RoutedEventArgs e)
        {
            ApplicationDBEntities1 db = new ApplicationDBEntities1();
            Album albumObject         = new Album()
            {
                albumName = album_name.Text,
            };

            db.Albums.Add(albumObject);
            db.SaveChanges();
            this.loadAbums();
        }
Exemple #3
0
        private void deleteAlbum_Click(object sender, RoutedEventArgs e)
        {
            ApplicationDBEntities1 db = new ApplicationDBEntities1();
            var selectedItem          = from el in db.Albums
                                        where el.id == this.albumSelected
                                        select el;

            Album albumToDelete = selectedItem.SingleOrDefault();

            if (albumToDelete != null)
            {
                db.Albums.Remove(albumToDelete);
                db.SaveChanges();
            }
            this.loadAbums();
        }
Exemple #4
0
        private void deleteTag_Click(object sender, RoutedEventArgs e)
        {
            ApplicationDBEntities1 db = new ApplicationDBEntities1();
            var selectedItem          = from el in db.Tags
                                        where el.id == this.tagSelected
                                        select el;

            Tag tagToDelete = selectedItem.SingleOrDefault();

            if (tagToDelete != null)
            {
                db.Tags.Remove(tagToDelete);
                db.SaveChanges();
            }
            this.loadTags();
        }
        private void addAlbum_Click(object sender, RoutedEventArgs e)
        {
            //TO DO: Grab selected album and add image to DB ImagesAlbums
            // Re-load the list

            ApplicationDBEntities1 db          = new ApplicationDBEntities1();
            ImagesInAlbum          albumObject = new ImagesInAlbum()
            {
                fileID  = this.imgID,
                albumID = albumSelectedToAddRemove
            };

            db.ImagesInAlbums.Add(albumObject);
            db.SaveChanges();
            this.loadAbums();
        }