public async Task <ActionResult> ProfileList(int userId)
        {
            var model = new ProfileListModel();

            model.UserId = userId;

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(ConfigurationManager.AppSettings["BaseUrl"]);
                client.DefaultRequestHeaders.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage Res = await client.GetAsync("api/SignUpAPI/GetRelationships?isActive=true&relationship=&excludeSelf=false");

                model.Relationships = JsonConvert.DeserializeObject <List <RelationshipMaster> >(Res.Content.ReadAsStringAsync().Result);

                Res = await client.GetAsync("api/SignUpAPI/GetGenders?isActive=true&genderName=");

                model.Genders = JsonConvert.DeserializeObject <List <Gender> >(Res.Content.ReadAsStringAsync().Result);

                Res = await client.GetAsync("api/SignUpAPI/GetProfiles?userId=" + userId.ToString() + "&profileId=");

                model.Profiles = JsonConvert.DeserializeObject <List <Profile> >(Res.Content.ReadAsStringAsync().Result);
            }

            return(View(model));
        }
        public IActionResult Index()
        {
            //var profiles = new List<ProfileModel>();

            //foreach (var user in _userManager.Users.ToList())
            //{
            //    profiles.Add(new ProfileModel()
            //    {
            //        Email = user.Email,
            //        UserName = user.UserName,
            //        ProfileImageUrl = user.ProfileImageUrl,
            //        UserRating = user.Rating.ToString(),
            //        MemberSince = user.MemberSince
            //    });
            //}


            var profiles = _userService.GetAll()
                           .OrderByDescending(user => user.Rating)
                           .Select(u => new ProfileModel
            {
                Email           = u.Email,
                UserName        = u.UserName,
                ProfileImageUrl = u.ProfileImageUrl,
                UserRating      = u.Rating.ToString(),
                MemberSince     = u.MemberSince
            });

            var model = new ProfileListModel
            {
                Profiles = profiles
            };

            return(View(model));
        }
Exemple #3
0
        public async Task <IActionResult> Index(int page = 1)
        {
            if (User.Identity.IsAuthenticated)
            {
                var profiles = _userService.GetAll().OrderBy(user => user.MemberSince)
                               .Select(u => new ProfileModel
                {
                    Email           = u.Email,
                    UserId          = u.Id,
                    UserName        = u.UserName,
                    ProfileImageUrl = u.ProfileImageUrl,
                    UserRating      = u.Rating.ToString(),
                    MemberSince     = u.MemberSince,
                    PostCount       = _postService.GetUserPostCount(u.Id)
                });

                var model = new ProfileListModel
                {
                    Profiles = profiles
                };

                //TODO refractor this View Model instead of Data Model
                var item      = _context.ApplicationUsers.AsNoTracking().OrderBy(user => user.MemberSince);
                var dataModel = await PagingList <ApplicationUser> .CreateAsync(item, 4, page);

                return(View(dataModel));
            }
            else
            {
                return(Redirect("/Identity/Account/Register"));
            }
        }
Exemple #4
0
        public IActionResult Index()
        {
            var profiles = _userService.GetAll().Select(u => new ProfileModel
            {
                Email    = u.Email,
                UserName = u.UserName,
                UserId   = u.Id
            });

            var model = new ProfileListModel
            {
                Profiles = profiles
            };

            return(View(model));
        }
Exemple #5
0
        public IActionResult Index()
        {
            var profiles = _userService.GetAll().
                           OrderByDescending(user => user.Rating).
                           Select(u => new ProfileModel {
                Email           = u.Email,
                UserName        = u.UserName,
                ProfileImageUrl = u.ProfileImageUrl,
                UserRating      = u.Rating.ToString(),
                MemberSince     = u.MemberSince
            });
            var model = new ProfileListModel {
                Profiles = profiles
            };

            return(View(model));
        }
        public IActionResult Index()
        {
            var profiles = _user.GetAll().Select(u => new ProfileModel
            {
                UserId          = u.Id,
                Email           = u.Email,
                UserName        = u.UserName,
                ProfileImageUrl = u.ProfileImageUrl,
                UserRating      = u.Rating.ToString(),
                MemberSince     = u.MemberSince
            });

            var model = new ProfileListModel
            {
                Profiles = profiles
            };

            return(View(model));
        }
        public async Task <IActionResult> Index()
        {
            var profiles = await this.userManager.GetUsersAsync <ApplicationUser, ProfileModel>();

            var model = new ProfileListModel
            {
                Profiles = profiles
                           .Select(
                    c =>
                {
                    c.IsAdmin = this.userManager.IsUserAdmin(c.UserId).Result;
                    return(c);
                })

                           .ToList(),
            };

            return(this.View(model));
        }
        public async Task <IActionResult> DeleteUser(ProfileListModel model, string id)
        {
            ApplicationUser user = await _userManager.FindByIdAsync(id);

            //var user = _context.Users.Where(u => u.Id == id);
            if (user != null)
            {
                var replies = _context.PostReplies.Where(r => r.User.Id == id).ToList();
                replies.ForEach(r => _context.PostReplies.Remove(r));
                var posts = _context.Posts.Where(p => p.User.Id == id).ToList();
                posts.ForEach(p => _context.Posts.Remove(p));
                await _context.SaveChangesAsync();

                //await _userManager.DeleteAsync(user);
                await _userManager.DeleteAsync(user);
            }
            await _context.SaveChangesAsync();

            return(RedirectToAction("Index", "Profile"));
        }
        public IActionResult Index()
        {
            var profiles = _userService.GetAll()
                           .OrderByDescending(rating => rating.Rating)
                           .Select(u => new ProfileModel
            {
                UserId          = u.Id,
                Email           = u.Email,
                MemberSince     = u.MemberSince,
                UserName        = u.UserName,
                UserRating      = u.Rating,
                ProfileImageUrl = u.ImageUrl
            });

            var model = new ProfileListModel
            {
                Profiles = profiles
            };

            return(View(model));
        }
Exemple #10
0
        public IActionResult Index()
        {
            var profiles = _userService.GetAll()
                           .OrderByDescending(user => user.Rating)
                           .Select(user => new ProfileModel
            {
                id              = user.Id,
                Email           = user.Email,
                UserName        = user.UserName,
                ProfileImageUrl = user.ProfileImageUrl,
                UserRating      = user.Rating.ToString(),
                MemberSince     = user.MemberSince,
                IsActive        = user.IsActive,
                IsAdmin         = IsUserAdmin(user)
            });
            var model = new ProfileListModel
            {
                Profiles = profiles
            };

            return(View(model));
        }
        public IActionResult Index()
        {
            var profiles = _userService.GetAll()
                           .OrderByDescending(u => u.MemberSince)
                           .Select(p => new ProfileModel
            {
                UserId   = p.Id,
                FIO      = p.FIO,
                CompName = p.CompanyName,
                OKPOname = p.OkpoName,
                City     = p.Sity,
                Since    = p.MemberSince,
                Phone    = p.PhoneNumber,
                Email    = p.Email
            });
            var model = new ProfileListModel
            {
                Profiles = profiles
            };

            return(View(model));
        }
Exemple #12
0
        public IActionResult ModeratorPanel()
        {
            var profiles = _userService.GetAll().OrderBy(user => user.UserName)
                           .Select(u => new ProfileModel
            {
                Email           = u.Email,
                UserId          = u.Id,
                UserName        = u.UserName,
                ProfileImageUrl = u.ProfileImageUrl,
                UserRating      = u.Rating.ToString(),
                MemberSince     = u.MemberSince,
                PostCount       = _postService.GetUserPostCount(u.Id),
                IsAdmin         = IsUserAdmin(u),
                IsModerator     = IsUserModerator(u)
            });

            var model = new ProfileListModel
            {
                Profiles = profiles,
            };

            return(View(model));
        }