Exemplo n.º 1
0
        public async Task <IActionResult> Index()
        {
            IdentityUser user = await _userManager.GetUserAsync(User);

            DateTime lastLogin = await _usersHandler.GetPreviousLoginAttempt(user);

            int numLoginsThisMonth = await _usersHandler.GetNumLoginsThisMonth(user);

            string username  = user.UserName;
            int    numUnread = await _messagesHandler.CountUserUnreadMessegesAsync(username);

            UserHomeViewModel vm = new UserHomeViewModel
            {
                Username           = user.UserName,
                NumUnreadMessages  = numUnread,
                LastLogin          = lastLogin,
                NumLoginsThisMonth = numLoginsThisMonth
            };

            return(View(vm));
        }