Exemplo n.º 1
0
        // GET: IGUser
        public ActionResult Index()
        {
            string name = "";
            IGUser iGUser;

            try
            {
                name   = Request.Url.Query.Replace("?user="******"NoUser"));
            }

            return(View());
        }
Exemplo n.º 2
0
        private async Task <string> Add(string userId, UserSessionData user)
        {
            var followersCount = await this.instaApi.UserProcessor.GetUserFollowersAsync(user.UserName, PaginationParameters.Empty);

            var followingCount = await this.instaApi.UserProcessor.GetUserFollowingAsync(user.UserName, PaginationParameters.Empty);

            long followers = 0;
            long following = 0;

            if (followersCount.Value != null)
            {
                followers = followersCount.Value.Count;
            }

            if (followingCount.Value != null)
            {
                following = followingCount.Value.Count;
            }

            IGUser igUser = new IGUser
            {
                UserId         = userId,
                IGFullname     = user.LoggedInUser.FullName,
                IGProfileId    = user.LoggedInUser.Pk,
                IGUserName     = user.LoggedInUser.UserName,
                ProfilePicUrl  = user.LoggedInUser.ProfilePicUrl,
                FollowersCount = followers,
                FollowingCount = following,
            };
            var existingUser = this.igUsersRepository.All().Where(u => u.IGUserName == igUser.IGUserName).FirstOrDefault();

            if (existingUser != null)
            {
                existingUser.UserId = igUser.UserId;
                this.igUsersRepository.Update(existingUser);
            }
            else
            {
                await this.igUsersRepository.AddAsync(igUser);
            }

            await this.igUsersRepository.SaveChangesAsync();

            return(igUser.Id);
        }
Exemplo n.º 3
0
        // GET: IGUser
        public ActionResult Index()
        {
            string name = "";
            IGUser iGUser;

            try
            {
                name   = Request.Url.Query.Replace("?user="******"NoUser"));
            }


            return(View());
        }