Example #1
0
        private PlayList CreateExamplePlayList(int accountid, string playlistname, string tags, List <Video> videos)
        {
            try
            {
                IPlayListRepository playlistrep = new EntityPlayListRepository();

                PlayList playlist = new PlayList();
                playlist.AccountID    = accountid;
                playlist.PlayListName = playlistname;
                playlist.Tags         = tags;
                playlist.IsActive     = true;
                playlistrep.CreatePlayList(playlist);

                IPlayListVideoXrefRepository plvxrefrep = new EntityPlayListVideoXrefRepository();
                int i = 1;
                foreach (Video video in videos)
                {
                    PlayListVideoXref xref = new PlayListVideoXref();
                    xref.PlayOrder  = i;
                    xref.PlayListID = playlist.PlayListID;
                    xref.VideoID    = video.VideoID;
                    plvxrefrep.CreatePlayListVideoXref(xref);
                    i += 1;
                }

                return(playlist);
            }
            catch { return(null); }
        }
Example #2
0
 public void CreatePlayListVideoXref(PlayListVideoXref xref)
 {
     db.PlayListVideoXrefs.Add(xref);
     db.SaveChanges();
 }
        private PlayList CreateExamplePlayList(int accountid, string playlistname, string tags, List<Video> videos)
        {
            try
            {
                IPlayListRepository playlistrep = new EntityPlayListRepository();

                PlayList playlist = new PlayList();
                playlist.AccountID = accountid;
                playlist.PlayListName = playlistname;
                playlist.Tags = tags;
                playlist.IsActive = true;
                playlistrep.CreatePlayList(playlist);

                IPlayListVideoXrefRepository plvxrefrep = new EntityPlayListVideoXrefRepository();
                int i = 1;
                foreach (Video video in videos)
                {
                    PlayListVideoXref xref = new PlayListVideoXref();
                    xref.PlayOrder = i;
                    xref.PlayListID = playlist.PlayListID;
                    xref.VideoID = video.VideoID;
                    plvxrefrep.CreatePlayListVideoXref(xref);
                    i += 1;
                }

                return playlist;
            }
            catch { return null; }
        }