Beispiel #1
0
        /// <summary>
        /// 获取员工列表
        /// </summary>
        /// <returns></returns>
        public PagedResult <Users> GetUserList(UsersParameter parameter)
        {
            string sqlstr = $"select * from (select ROW_NUMBER() OVER(ORDER BY s.UserID )AS Row,s.* from Users s) ss  WHERE ss.Row BETWEEN @StartIndex AND @EndIndex";

            List <Users> modelList = DbHelper.Query <Users>(sqlstr, new
            {
                StartIndex = parameter.SkipCount,
                EndIndex   = parameter.TakeCount
            });

            int totalCount = DbHelper.QuerySingle <int>("select * from Users");

            return(new PagedResult <Users>
            {
                PageIndex = parameter.PageIndex,
                PageSize = parameter.PageSize,
                TotalItemCount = totalCount,
                Items = modelList
            });
        }
        public async Task <IEnumerable <Users> > GetUsers([FromQuery] UsersParameter usersParameter)
        {
            var result = await _users.GetUsersasync(usersParameter);

            return(result);
        }
Beispiel #3
0
        /// <summary>
        /// 获取员工列表
        /// </summary>
        /// <returns></returns>
        public ActionResult GetUserList(UsersParameter parameter)
        {
            PagedResult <Users> userList = _userService.GetUserList(parameter);

            return(View(userList));
        }