private bool ExistingDataProcessingRegistrationWithSameNameInOrganization(int organizationId, string name, Maybe <int> exceptId) { return(_repository .Search(organizationId, name) .Transform ( inputQuery => exceptId .Select(id => inputQuery.Where(x => x.Id != id)) .GetValueOrFallback(inputQuery) ) .Any()); ; }
public Result <IQueryable <DataProcessingRegistration>, OperationError> GetOrganizationData(int organizationId, int skip, int take) { if (_authorizationContext.GetOrganizationReadAccessLevel(organizationId) < OrganizationDataReadAccessLevel.All) { return(new OperationError(OperationFailure.Forbidden)); } if (take < 1 || skip < 0 || take > PagingContraints.MaxPageSize) { return(new OperationError("Invalid paging arguments", OperationFailure.BadInput)); } var registrations = _repository .Search(organizationId, Maybe <string> .None) .OrderBy(x => x.Id) .Skip(skip) .Take(take); return(Result <IQueryable <DataProcessingRegistration>, OperationError> .Success(registrations)); }