Exemplo n.º 1
0
        public IActionResult Index([FromRoute] int p = 1)
        {
            Models.ThemeViewModel viewModel = new Models.ThemeViewModel();
            //获取数据
            var repository        = _unitOfWork.GetRepository <Entity.m_DocsTheme>();
            var accountRepository = _unitOfWork.GetRepository <m_Account>();

            viewModel.ThemeListData = repository.Query()
                                      .Join(accountRepository.Query(), t => t.AccountId, acc => acc.AccountId, (t, acc) => new Models.ThemeDataModel()
            {
                ThemeId    = t.ThemeId.Value,
                HeadUrl    = acc.HeadUrl,
                IsShow     = t.IsShow.Value,
                LastTime   = t.LastTime.Value,
                PlusCount  = t.PlusCount.Value,
                NickName   = acc.NickName,
                AppendTime = t.AppendTime.Value,
                ReadCount  = t.ReadCount.Value,
                Title      = t.Title,
                Tags       = t.Tags,
                AccountId  = t.AccountId.Value
            })
                                      .OrderByDescending(q => q.ThemeId)
                                      .Skip(10 * (p - 1))
                                      .Take(10)
                                      .ToList();
            viewModel.TotalCount = repository.Query().Select(q => q.ThemeId).Count();
            return(View(viewModel));
        }
Exemplo n.º 2
0
        public IActionResult Index([FromRoute] int p = 1)
        {
            Models.ThemeViewModel viewModel = new Models.ThemeViewModel();
            //获取数据
            var apiResult = HttpCore.HttpGet($"/api/Docs/Theme/{p}");

            if (apiResult.Code == 0)
            {
                viewModel.ThemeListData = JsonConvert.DeserializeObject <List <Models.ThemeDataModel> >(apiResult.Data.ToString());
            }
            return(View(viewModel));
        }