Exemple #1
0
        public void AddArtist(Guid id, string description)
        {
            var ent    = new MediaCatalogueEntities();
            var artist = new Music_Artist();

            artist.id   = id;
            artist.Name = description;
            ent.AddToMusic_Artist(artist);
            ent.SaveChanges();
        }
Exemple #2
0
        public void AddGenre(Guid id, string description)
        {
            var ent   = new MediaCatalogueEntities();
            var genre = new Music_Genre();

            genre.id          = id;
            genre.Description = description;
            ent.AddToMusic_Genre(genre);
            ent.SaveChanges();
        }
Exemple #3
0
        public void UpdateGenre(Guid id, string description)
        {
            var ent   = new MediaCatalogueEntities();
            var genre = (from g in ent.Music_Genre
                         where g.id == id
                         select g).FirstOrDefault();

            if (genre != null)
            {
                genre.Description = description;
                ent.SaveChanges();
            }
        }
Exemple #4
0
        public MusicGenre[] GetGenres()
        {
            var ent    = new MediaCatalogueEntities();
            var genres = (from g in ent.Music_Genre
                          orderby g.Description
                          select new MusicGenre
            {
                id = g.id,
                Description = g.Description
            }).ToList();

            return(genres.ToArray());
        }
Exemple #5
0
        public void UpdateArtist(Guid id, string description)
        {
            var ent    = new MediaCatalogueEntities();
            var artist = (from a in ent.Music_Artist
                          where a.id == id
                          select a).FirstOrDefault();

            if (artist != null)
            {
                artist.Name = description;
                ent.SaveChanges();
            }
        }
Exemple #6
0
        public void AddVideoClip(MusicVideoClip clip)
        {
            var ent = new MediaCatalogueEntities();

            var vc = new Music_Track();

            vc.id       = clip.id;
            vc.Duration = clip.Duration;

            // ToDo: Find/Add the artist and Genre entities

            ent.AddToMusic_Track(vc);       // This will change when Genre and Artist are linked to this Music_Track (no need to Add the newly created entity).
        }
Exemple #7
0
        public MusicArtist[] GetArtists()
        {
            var ent     = new MediaCatalogueEntities();
            var artists = (from a in ent.Music_Artist
                           orderby a.Name
                           select new MusicArtist
            {
                id = a.id,
                Description = a.Name
            }).ToList();

            return(artists.ToArray());
        }
Exemple #8
0
        public MusicVideoClip GetVideoClip(Guid id)
        {
            var ent = new MediaCatalogueEntities();

            var clip = (from c in ent.Music_Track.Include("Media_Item")
                        .Include("Music_Artist")
                        .Include("Music_Genre")
                        where c.Media_Item.id == id
                        select new MusicVideoClip
            {
                id = c.id,
                SongName = c.Media_Item.Title,
                Duration = c.Duration.HasValue ? c.Duration.Value : 0,
                Artist = c.Music_Artist.Name,
                Genre = c.Music_Genre.Description
            }).FirstOrDefault();

            return(clip);
        }
Exemple #9
0
        public void UpdateVideoClip(MusicVideoClip clip)
        {
            var ent = new MediaCatalogueEntities();

            var vc = (from c in ent.Music_Track.Include("Media_Item")
                      .Include("Music_Genre")
                      .Include("Music_Artist")
                      where c.id == clip.id
                      select c).FirstOrDefault();

            if (vc != null)
            {
                vc.Media_Item.Title = clip.SongName;
                vc.Duration         = clip.Duration;

                // ToDo: Find the right Genre and Artist entities, and update the references

                ent.SaveChanges();
            }
        }