public Result <bool> ExistOrganizationUser(int organizationUserId, int organizationId) { if (organizationUserId <= 0) { return(new Result <bool>(OrganizationUserServiceErrors.InvalidOrganizationUserId())); } if (organizationId <= 0) { return(new Result <bool>(OrganizationUserServiceErrors.InvalidOrganizationId())); } var organizationUserResult = organizationUserRepository.OrganizationUserExists(organizationUserId, organizationId); return(new Result <bool>(organizationUserResult)); }
public Result <bool> ExistOrganizationUser(int?organizationUserId, int?userType, int?organizationId) { if (!organizationUserId.HasValue) { return(new Result <bool>(OrganizationUserServiceErrors.InvalidOrganizationUserId())); } if (!userType.HasValue) { return(new Result <bool>(OrganizationUserServiceErrors.InvalidUserTypeIdError())); } if (!organizationId.HasValue) { return(new Result <bool>(OrganizationUserServiceErrors.InvalidOrganizationId())); } var organizationUserResult = organizationUserRepository.OrganizationUserExists(organizationUserId.Value, userType.Value, organizationId.Value); return(new Result <bool>(organizationUserResult)); }
public Result <AnyOrganizationUserWithSharedUserId> DeleteOrganizationUser(int?organizationUserId, int?userType, int?organizationId) { if (!organizationId.HasValue) { return(new Result <AnyOrganizationUserWithSharedUserId>(OrganizationUserServiceErrors.InvalidOrganizationId())); } if (!userType.HasValue) { return(new Result <AnyOrganizationUserWithSharedUserId>(OrganizationUserServiceErrors.InvalidUserTypeId())); } if (!organizationUserId.HasValue) { return(new Result <AnyOrganizationUserWithSharedUserId>(OrganizationUserServiceErrors.InvalidOrganizationUserId())); } if (!organizationUserRepository.OrganizationUserExists(organizationUserId.Value, organizationId.Value)) { return(new Result <AnyOrganizationUserWithSharedUserId>(OrganizationUserServiceErrors.NotFoundError())); } var deletedAt = organizationUserRepository.DeleteOrganizationUser(organizationUserId.Value, userType.Value, organizationId.Value); groupRepository.DisassociateOrganizationUserFromAllGroups(new DisassociateOrganizationUserFromAllGroupsCommand { OrganizationId = organizationId.Value, OrganizationUserId = organizationUserId.Value }); var isLastUserIdRelationship = organizationUserRepository.AnyOrganizationUserWithSharedUserId(organizationUserId.Value); isLastUserIdRelationship.DeletedAt = deletedAt; var publishResult = PublishDeleteOrganizationUser( organizationUserId.Value, userType.Value, deletedAt, organizationId.Value); return(new Result <AnyOrganizationUserWithSharedUserId>(isLastUserIdRelationship)); }