예제 #1
0
        /// <summary>
        /// 获取数据
        /// </summary>
        /// <param name="pageIndex"></param>
        public virtual async Task GetPageData(int pageIndex)
        {
            var r = await repository.GetAllListAsync(new QueryParameters()
            {
                PageIndex = this.PageIndex,
                PageSize  = this.PageSize,
                Search    = this.Search
            });

            if (r.StatusCode == 200)
            {
                GridModelList = new ObservableCollection <TEntity>(r.Result.Items.ToList());
                TotalCount    = r.Result.TotalCount;
                SetPageCount();
            }
        }
예제 #2
0
        /// <summary>
        /// 获取数据
        /// </summary>
        /// <param name="pageIndex"></param>
        public virtual async Task GetPageData(int pageIndex)
        {
            var r = await repository.GetAllListAsync(new QueryParameters()
            {
                PageIndex = this.PageIndex,
                PageSize  = this.PageSize,
                Search    = this.Search
            });

            if (r.StatusCode == 200)
            {
                var pagedList = JsonConvert.DeserializeObject <PagedList <TEntity> >(r.Result.ToString());
                GridModelList = new ObservableCollection <TEntity>(pagedList?.Items.ToList());
                TotalCount    = GridModelList.Count;
                SetPageCount();
            }
        }
        /// <summary>
        /// 获取数据
        /// </summary>
        /// <param name="pageIndex"></param>
        public virtual async Task GetPageData(int pageIndex)
        {
            var r = await repository.GetAllListAsync(new QueryParameters()
            {
                PageIndex = this.PageIndex,
                PageSize  = this.PageSize,
                Search    = this.Search
            });

            if (r != null && r.success)
            {
                GridModelList = new ObservableCollection <TEntity>();
                r.dynamicObj.Items?.ToList().ForEach(arg =>
                {
                    GridModelList.Add(arg);
                });
                TotalCount = r.dynamicObj.Items.Count;
                SetPageCount();
            }
        }