Exemplo n.º 1
0
        public async Task <IActionResult> Index(string username)
        {
            ApplicationUser AppUser = await _userManager.FindByNameAsync(username);

            var user        = HttpContext.User;
            var currentUser = _userManager.GetUserName(user);

            var viewUserFriends = await _friendships.GetFriendshipsForUser(username);

            var userFriends = await _friendships.GetFriendshipsForUser(currentUser);

            var userSentRequests = await _friendships.GetSentFriendRequestsForUser(currentUser);

            var userReceivedRequests = await _friendships.GetReceivedFriendRequestsForUser(currentUser);

            var userEventSignups = await _posts.GetAllSignedupEventsForPlayer(username);

            FriendshipsViewModel fvm = new FriendshipsViewModel()
            {
                User               = AppUser,
                Friends            = userFriends,
                ReceivedRequests   = userReceivedRequests,
                SentRequests       = userSentRequests,
                ViewUserFriends    = viewUserFriends,
                UserSignedupEvents = userEventSignups
            };

            return(View(fvm));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Index()
        {
            if (_signInManager.IsSignedIn(User))
            {
                CurrentUser = await _userManager.GetUserAsync(HttpContext.User);

                ViewBag.Friends = await _frendships.GetFriendshipsForUser(CurrentUser.UserName);
            }

            ViewBag.Posts = await _post.GetLastTenPosts();

            return(View());
        }
Exemplo n.º 3
0
        public async Task <IViewComponentResult> InvokeAsync(string username)
        {
            var friends = await _friendships.GetFriendshipsForUser(username);

            return(View(friends));
        }