Beispiel #1
0
        /// <summary>
        /// 获取所有用户数据
        /// </summary>
        /// <param name="userManagerSerach">查询条件</param>
        /// <returns></returns>
        public async Task <IActionResult> GetList([FromQuery] UserManagerSerach userManagerSerach)
        {
            if (!string.IsNullOrWhiteSpace(userManagerSerach.Name))
            {
                LinqComm <UserManager> .And(d => d.RealName.Contains(userManagerSerach.Name));
            }
            if (!string.IsNullOrWhiteSpace(userManagerSerach.IsEnabled))
            {
                bool isEnabled = bool.Parse(userManagerSerach.IsEnabled);
                LinqComm <UserManager> .And(d => d.IsEnabled == isEnabled);
            }
            var result = await _userManagerServices.GetListPagedAsync(Specification <UserManager> .Eval(LinqComm <UserManager> .GetExpression()), d => d.Sid, SortOrder.Descending, userManagerSerach.Page, userManagerSerach.Limit);

            var data = result.data.Select(d => new UserList
            {
                Id          = d.Id,
                Sid         = d.Sid,
                UserName    = d.RealName,
                Email       = d.Email,
                Mobilephone = d.Mobilephone,
                IsEnabled   = d.IsEnabled,
                CreateUser  = d.CreateUser == null ? "" : d.CreateUser.RealName,
                CreateTime  = d.CreateTime
            }).ToList();

            return(Json(new PageResult <UserList> {
                code = result.code, msg = result.msg, data = data, count = result.count
            }));
        }
Beispiel #2
0
        /// <summary>
        /// 获取所有角色数据
        /// </summary>
        /// <param name="roleSerach">查询条件</param>
        /// <returns></returns>
        public async Task <IActionResult> GetList([FromQuery] RoleSerach roleSerach)
        {
            if (!string.IsNullOrWhiteSpace(roleSerach.Name))
            {
                LinqComm <Role> .And(d => d.Name.Contains(roleSerach.Name));
            }
            var getResult = await _roleServices.GetListPagedAsync(Specification <Role> .Eval(LinqComm <Role> .GetExpression()), d => d.Sid, SortOrder.Descending, roleSerach.Page, roleSerach.Limit);

            var roleList = getResult.data.Select(d => new RoleList
            {
                Id         = d.Id,
                RoleName   = d.Name,
                Sid        = d.Sid,
                Remarks    = d.Remarks,
                UpdateTime = d.UpdateTime,
                UpdateUser = d.UpdateUser?.RealName,
                IsDefault  = d.IsDefault
            }).ToList();

            return(Json(new PageResult <RoleList>
            {
                code = getResult.code,
                msg = getResult.msg,
                count = getResult.count,
                data = roleList
            }));
        }
        /// <summary>
        /// 获取所有菜单数据
        /// </summary>
        /// <param name="menuSerach">查询条件</param>
        /// <returns></returns>
        public async Task <IActionResult> GetList([FromQuery] MenuSerach menuSerach)
        {
            if (!string.IsNullOrWhiteSpace(menuSerach.Name))
            {
                LinqComm <Menu> .And(d => d.Name.Contains(menuSerach.Name));
            }
            var getResult = await _menuServices.GetListPagedAsync(Specification <Menu> .Eval(LinqComm <Menu> .GetExpression()), d => d.Sort, SortOrder.Ascending, menuSerach.Page, menuSerach.Limit);

            var menuList = getResult.data.Select(d => new MenuList
            {
                Id             = d.Id,
                MenuName       = d.Name,
                Sid            = d.Sid,
                ParentMenuName = d.ParentMenu?.Name,
                Code           = d.Code,
                Icon           = d.Icon,
                Url            = d.BaseUrl,
                UpdateTime     = d.UpdateTime,
                UpdateUser     = d.UpdateUser?.RealName,
                Sort           = d.Sort,
                IsHasChildren  = d.ChildrenMenus.Any(x => !x.IsDelete)
            }).ToList();

            return(Json(new PageResult <MenuList>
            {
                code = getResult.code,
                msg = getResult.msg,
                count = getResult.count,
                data = menuList
            }));
        }
        /// <summary>
        /// 获取所有按钮数据
        /// </summary>
        /// <param name="buttonSerach">查询条件</param>
        /// <returns></returns>
        public async Task <IActionResult> GetList([FromQuery] ButtonSerach buttonSerach)
        {
            if (!string.IsNullOrWhiteSpace(buttonSerach.Name))
            {
                LinqComm <Button> .And(d => d.Name.Contains(buttonSerach.Name));
            }
            var result = await _buttionServices.GetListPagedAsync(Specification <Button> .Eval(LinqComm <Button> .GetExpression()), d => d.Sort, SortOrder.Ascending, buttonSerach.Page, buttonSerach.Limit);

            var data = result.data.Select(d => new ButtonList
            {
                Id          = d.Id,
                Sid         = d.Sid,
                Name        = d.Name,
                Code        = d.Code,
                Sort        = d.Sort,
                UpdateTime  = d.UpdateTime,
                UpdateUser  = d.UpdateUser == null ? "" : d.CreateUser.RealName,
                Description = d.Description
            }).ToList();

            return(Json(new PageResult <ButtonList> {
                code = result.code, msg = result.msg, data = data, count = result.count
            }));
        }