Exemplo n.º 1
0
        private IEnumerable <ProfileModel> GetUsers(IEnumerable <string> keywords, string searchOptions, string sortingOptions)
        {
            var users = _userService.GetAll();

            foreach (var keyword in keywords) //Performs one step lookup further into the search. If the next keyword lookup produces an empty result, then skip it
            {
                var oneStepLookup = users.Where(user => StringContains(user.UserName, keyword));
                if (oneStepLookup.FirstOrDefault() != null)
                {
                    users = oneStepLookup;
                }
            }
            if (sortingOptions.Equals("Votes"))
            {
                users = users.OrderByDescending(users => users.Ratting);
            }
            else
            {
                users = users.OrderByDescending(user => user.MemberSince);
            }
            return(users.Select(user => new ProfileModel
            {
                Username = user.UserName,
                ProfileImageUrl = user.ProfileImageUrl,
                UserRating = user.Ratting,
                MemmberSince = user.MemberSince
            }));
        }
Exemplo n.º 2
0
        public IActionResult Scores()
        {
            var userModel = _service.GetAll().Select(user => new ProfileModel
            {
                ProfileImageUrl = user.ProfileImageUrl,
                Username        = user.UserName,
                UserRating      = user.Ratting
            })
                            .OrderByDescending(x => x.UserRating)
                            .ToList();;

            var userList = new ProfileModelList {
                ProfileList = userModel
            };

            return(View(userList));
        }
Exemplo n.º 3
0
        public IActionResult AssignUser()
        {
            var userModel = _userService.GetAll().Select(user => new ProfileModel
            {
                UserId     = user.Id,
                Username   = user.UserName,
                UserRating = user.Ratting,
                Warnings   = user.AccountWarnings
            })
                            .ToList();

            var userList = new ProfileModelList {
                ProfileList = userModel
            };

            return(View(userList));
        }