Avoid null values in module and change status services
This commit is contained in:
		| @@ -100,13 +100,17 @@ namespace Core.Thalos.Provider.Providers.Onboarding | ||||
|         /// <returns> | ||||
|         /// A <see cref="ValueTask{RoleAdapter}"/> representing the asynchronous execution of the service. | ||||
|         /// </returns> | ||||
|         public async ValueTask<RoleAdapter> ChangeRoleStatus(string _id, Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken) | ||||
|         public async ValueTask<RoleAdapter?> ChangeRoleStatus(string _id, Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken) | ||||
|         { | ||||
|             var entity = await repository.FindByIdAsync(_id); | ||||
|             entity.Status = newStatus; | ||||
|  | ||||
|             await repository.ReplaceOneAsync(entity); | ||||
|             return entity; | ||||
|             if (entity is not null) | ||||
|             { | ||||
|                 entity.Status = newStatus; | ||||
|  | ||||
|                 return repository.ReplaceOneAsync(entity).Result; | ||||
|             } | ||||
|             else return null; | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
| @@ -117,10 +121,10 @@ namespace Core.Thalos.Provider.Providers.Onboarding | ||||
|         /// <returns> | ||||
|         /// A <see cref="ValueTask{RoleAdapter}"/> representing the asynchronous execution of the service. | ||||
|         /// </returns> | ||||
|         public async ValueTask<RoleAdapter> UpdateRole(RoleAdapter entity, CancellationToken cancellationToken) | ||||
|         public async ValueTask<RoleAdapter?> UpdateRole(RoleAdapter entity, CancellationToken cancellationToken) | ||||
|         { | ||||
|             await repository.ReplaceOneAsync(entity); | ||||
|             return entity; | ||||
|             var updatedEntity = await repository.ReplaceOneAsync(entity); | ||||
|             return updatedEntity; | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user