public async Task <IActionResult> Index(string username) { if (!_service.IfUserExists(username)) { return(NotFound()); } var user = _service.GetByUserName(username); if (user.ProfileImageUrl == null) { user.ProfileImageUrl = defaultAvatar; } //want a list of threads // threads will only display if you press your username when logged in button other wise it will not display the users threads var threads = BuildThreadList(username); //want a list of channels that the user is part of, tick var channels = BuildChannelsList(username); //calc the users Ratting var ratting = _service.GetRatting(username, threads); //list of all the users that the user follows var listOfFollower = _service.UsersFollowers(user); //user roles var userRoles = _userManager.GetRolesAsync(user); //gives the inital achievements to the user await _achievementService.AssignAchievementsToUser(user); //list of all the threads a user likes var likeList = _threadService.GetLikedThreads(user.Id); //list of all the users that follow the user var usersfollowing = _service.UserFollowingList(user); //list of users that the user follows var folllowingUsers = _service.ListOfFollowing(user); /* * Achievements HERE */ //makes sure that the user is the user if (username == user.UserName) { await GiveUserLoginAch(user); } if (listOfFollower.Count() != _achievementService.FollowAchievementProgress(user) && _achievementService.GetUsersAchievement(user).Count() != 0) { GiveTenFollowAch(user); } //build model var model = new ProfileModel() { Username = user.UserName, UserId = user.Id, UserRating = ratting, Email = user.Email, ProfileImageUrl = user.ProfileImageUrl, MemmberSince = user.MemberSince, Threads = threads, Channels = channels, UsersFollowed = usersfollowing, Warnings = user.AccountWarnings, Roles = userRoles, Likes = likeList, FollowsUser = folllowingUsers, }; return(View(model)); }