public ActionResult AllUsers(string searchTerm) { List <User> allUsers; if (searchTerm == null || searchTerm == "") { allUsers = socialRepository.GetAllUsers(currentUser.UserId); ViewBag.Title = "All Users"; } else if (searchTerm == "mutual") { allUsers = socialRepository.PeopleYouMayKnow(currentUser.UserId); ViewBag.Title = "People You May Know"; ViewBag.IsPeople = true; } else { ViewBag.Title = "Search Users"; ViewBag.SearchTerm = searchTerm; allUsers = socialRepository.SearchUsers(currentUser.UserId, searchTerm); } List <string> friendIds; if (currentUser.FriendIds == null || currentUser.FriendIds == "") { friendIds = null; } else { friendIds = currentUser.FriendIds.Split(',').ToList(); } UserInfoModel userInfo = new UserInfoModel() { User = currentUser, CurrentUserId = currentUser.UserId, FriendIds = friendIds, OtherUsers = allUsers, FriendRequestIds = friendRepository.GetFriendRequestIds(currentUser.UserId), SentFriendRequestIds = friendRepository.GetSentFriendRequestIds(currentUser.UserId) }; return(View(userInfo)); }