示例#1
0
        public async Task <ActionResult> MainPage(long userId)
        {
            userId = userId == 0 ? AbpSession.GetUserId() : userId;

            var userInfo = await _userAppService.GetUserInfoAsync(userId);

            return(View(new MainPageViewModel
            {
                UserId = userId,
                UserInfo = userInfo,
                ProblemTypes = await _problemAppService.GetAllProblemTypes(),
                ProblemSolutions = (await _problemAppService.GetAllSolutionWithFilter(new GetAllSolutionFilter
                {
                    UserId = userId,
                    MaxResultCount = int.MaxValue,
                    SkipCount = 0
                })).Solutions,
                Certificates = await _certificateAppService.GetAllCertificateSummary(userId),
                Articles = (await _articleAppService.GetArticleWithFilter(new GetArticleListFilter
                {
                    UserId = userId,
                    MaxResultCount = int.MaxValue,
                    SkipCount = 0
                })).Articles
            }));
        }
示例#2
0
        public async Task <ActionResult> GetUserProfile(long userId)
        {
            UserProfileViewModel model;

            if (await IsGrantedAsync(PermissionNames.PagesUsers_GetOne))
            {
                model = ObjectMapper.Map <UserProfileViewModel>(await _userAppService.GetAsync(userId));
            }
            else
            {
                model        = ObjectMapper.Map <UserProfileViewModel>(await _userAppService.GetUserInfoAsync(userId));
                model.UserId = userId;
            }

            if (await IsGrantedAsync(PermissionNames.PagesUsers_Certificate_GetAll))
            {
                model.Certificate = await _certificateAppService.GetByUserAsync(userId);
            }

            return(View("User/ProfilePartial/Profile", model));
        }