예제 #1
0
        public async Task <PagedResult <Information> > GetNewNoticeList(InformationParameter parameter)
        {
            string sql = $"select * from (select ROW_NUMBER() OVER(ORDER BY i.ID )AS Row,i.* from Information i where Name like @Name) ii where ii.Row between @StartIndex AND @EndIndex";


            List <Information> informationList = await DbHelper.QueryAsync <Information>(sql, new
            {
                Name       = "%" + parameter.Name + "%",
                StartIndex = parameter.SkipCount,
                EndIndex   = parameter.TakeCount
            });

            int totalCount = await DbHelper.QuerySingleAsync <int>("select count(0) from Information where Name like @Name ", new { Name = "%" + parameter.Name + "%" });

            return(new PagedResult <Information>
            {
                PageIndex = parameter.PageIndex,
                PageSize = parameter.PageSize,
                TotalItemCount = totalCount,
                Items = informationList
            });
        }
예제 #2
0
        /// <summary>
        /// 获取新闻通知
        /// </summary>
        /// <returns></returns>
        public async Task <ActionResult> GetInformationList(InformationParameter parameter)
        {
            PagedResult <Information> informationList = await _informationService.GetNewNoticeList(parameter);

            return(View(informationList));
        }