Esempio n. 1
0
        public string GetAllYoutubeChannelByUserIdAndProfileId(string UserId, string ProfileId)
        {
            Domain.Myfashion.Domain.YoutubeChannel lstYoutubeChannel = new Domain.Myfashion.Domain.YoutubeChannel();
            try
            {
                if (objYoutubeChannelRepository.checkYoutubeChannelExists(ProfileId, Guid.Parse(UserId)))
                {
                    lstYoutubeChannel = objYoutubeChannelRepository.getYoutubeChannelDetailsById(ProfileId, Guid.Parse(UserId));
                }
                else
                {
                    lstYoutubeChannel = objYoutubeChannelRepository.getYoutubeChannelDetailsById(ProfileId);
                }

                return(new JavaScriptSerializer().Serialize(lstYoutubeChannel));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return("Something Went Wrong");
            }
        }
Esempio n. 2
0
        public string GetYoutubeChannelVideos(string userid, string profileid)
        {
            string ret            = string.Empty;
            string strfinaltoken  = string.Empty;
            string channelDetails = string.Empty;

            Domain.Myfashion.Domain.YoutubeAccount objYoutubeAccount = objYoutubeAccountRepository.getYoutubeAccountDetailsById(profileid, Guid.Parse(userid));
            Domain.Myfashion.Domain.YoutubeChannel objYoutubeChannel = objYoutubeChannelRepository.getYoutubeChannelDetailsById(profileid, Guid.Parse(userid));

            oAuthTokenYoutube objoAuthTokenYoutube = new oAuthTokenYoutube();
            string            finaltoken           = objoAuthTokenYoutube.GetAccessToken(objYoutubeAccount.Refreshtoken);
            JObject           objArray             = JObject.Parse(finaltoken);

            //foreach (var item in objArray)
            //{
            try
            {
                strfinaltoken = objArray["access_token"].ToString();
                // break;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
            //}
            PlaylistItems objPlaylistItems = new PlaylistItems();

            try
            {
                channelDetails = objPlaylistItems.Get_PlaylistItems_List(strfinaltoken, GlobusGooglePlusLib.Authentication.oAuthTokenYoutube.Parts.snippet.ToString(), objYoutubeChannel.Uploadsid);
            }
            catch (Exception ex)
            {
            }



            return(channelDetails);
        }