Exemplo n.º 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
            }));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Index(int page, int user, string keyword)
        {
            var filter = new GetAllSolutionFilter
            {
                UserId  = user,
                Keyword = keyword ?? "",
                TypeIds = keyword.IsNullOrEmpty()
                    ? null
                    : (await _problemAppService.GetAllProblemTypes(keyword)).Select(t => t.Id),
                MaxResultCount = PageSize,
                SkipCount      = (page <= 1 ? 0 : page - 1) * PageSize
            };
            var res = await _problemAppService.GetAllSolutionWithFilter(filter);

            return(View("Index", new IndexViewModel
            {
                Solutions = res,
                Filter = filter
            }));
        }