public async Task <Response <ManageUserPermissionsDto> > ManagePermissionsAsync(string userId, string permissionValue, int?pageNumber, int?pageSize) { var user = await _userManager.GetUserByIdAsync(userId); if (user == null) { return(Response <ManageUserPermissionsDto> .Fail("No User Exists")); } var userPermissions = await _userManager.GetClaimsAsync(user); var allPermissions = PermissionHelper.GetAllPermissions(); if (!string.IsNullOrWhiteSpace(permissionValue)) { allPermissions = allPermissions.Where(x => x.Value.ToLower().Contains(permissionValue.Trim().ToLower())) .ToList(); } foreach (var permission in allPermissions) { if (userPermissions.Any(x => x.Value == permission.Value)) { permission.Checked = true; } } var paginatedList = PaginatedList <ManageClaimDto> .CreateFromLinqQueryable(allPermissions.AsQueryable(), pageNumber ?? 1, pageSize ?? 12); var manageUserPermissionsDto = new ManageUserPermissionsDto { UserId = userId, UserName = user.UserName, PermissionValue = permissionValue, ManagePermissionsDto = paginatedList }; return(allPermissions.Count > 0 ? Response <ManageUserPermissionsDto> .Success(manageUserPermissionsDto, "Successfully retrieved") : Response <ManageUserPermissionsDto> .Fail( $"No Permissions exist! Something is Wrong with {typeof(Permissions).Namespace} file")); }