public async Task <PagedResult <RolePermissionDto> > GetRolePermissionsAsync(RolePermissionFilter rolePermissionFilter)
        {
            var rolePermissionsPagedResult = await rolePermissionRepository.GetRolePermissionsAsync(rolePermissionFilter);

            var rolePermissionsModelPagedResult = new PagedResult <RolePermissionDto>();

            Mapper.Map(rolePermissionsPagedResult, rolePermissionsModelPagedResult);
            return(rolePermissionsModelPagedResult);
        }
Ejemplo n.º 2
0
        public async Task <PagedResult <RolePermission> > GetRolePermissionsAsync(RolePermissionFilter filter)
        {
            filter = filter ?? new RolePermissionFilter();

            var result = unitOfWork.Query(GetRolePermissionExpression(filter), filter.PropertiesToInclude);

            List <RolePermission> list = await result.OrderBy(filter.OrderBy)
                                         .Skip((filter.Page - 1) * filter.Skip).Take(filter.Take)
                                         .ToListAsync();

            var pagedResult = new PagedResult <RolePermission>
            {
                Data     = list,
                PageInfo = await GetPageInfo(x => x.Id, filter, GetRolePermissionExpression(filter))
            };

            return(pagedResult);
        }
        public async Task <IHttpActionResult> GetRolePermissions(RolePermissionFilter filter)
        {
            var rolePermissions = await rolePermissionManager.GetRolePermissionsAsync(filter);

            return(Ok(rolePermissions));
        }
Ejemplo n.º 4
0
        private Expression <Func <RolePermission, bool> > GetRolePermissionExpression(RolePermissionFilter filter)
        {
            Expression <Func <RolePermission, bool> > expression = null;

            if (filter.Id > 0)
            {
                expression = x => x.Id == filter.Id;
            }
            return(expression);
        }
Ejemplo n.º 5
0
        public async Task <RolePermission[]> GetByFilter(RolePermissionFilter filter)
        {
            var permissions = await permissionRepository.FindRolePermissionsByRoleIds(filter.RoleIds);

            return(mapper.Map <RolePermission[]>(permissions));
        }