Example #1
0
        public async Task <UserStatsVM> GetUserStats(PageUser user)
        {
            UserStatsVM stats = new UserStatsVM()
            {
                UserId        = user.Id,
                UserName      = user.UserName,
                UserRole      = _userManager.GetRolesAsync(user).Result.FirstOrDefault(),
                TotalMemes    = await _memeService.CountAsync(m => m.PageUser.UserName == user.UserName),
                TotalAccepted = await _memeService.CountAsync(m => m.PageUser.UserName == user.UserName && m.IsAccepted),
                TotalComments = await _commentService.CountAsync(m => m.PageUser.UserName == user.UserName),
                Joined        = user.CreationDate.ToString("dd/MM/yyyy"),
            };

            return(stats);
        }