Ejemplo n.º 1
0
        public async Task <TData <List <RoleEntity> > > GetPageListJson([FromQuery] RoleListParam param,
                                                                        [FromQuery] Pagination pagination)
        {
            var obj = await _roleBLL.GetPageList(param, pagination);

            return(obj);
        }
Ejemplo n.º 2
0
        private void getPageList(HttpContext context)
        {
            string sql="  ";
            string json = "";
            int pcount = 0;
            int totalcount = 0;
            string rolename = context.Request["rolename"];
            string   isreuse = context.Request["isreuse"];
            if (!string.IsNullOrEmpty(rolename))
            {
                sql += " and rolename like '%" + rolename + "%' ";
            }

            if (!string.IsNullOrEmpty(isreuse))
            {
                isreuse = isreuse == "true" ? "1" : "0";
                sql += " and isreuse = " + isreuse;
            }

            try
            {
                Dictionary<string, object> roList = roBLL.GetPageList(sql, sort, page, rows, out pcount, out totalcount);

                json = JsonConvert.SerializeObject(roList);
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                json = JsonConvert.SerializeObject("{IsSuccess:'false',Message:'服务器交互失败!'}");
            }

            context.Response.ContentType = "application/json";
            //返回JSON结果
            context.Response.Write(json);
            context.Response.End();
        }