Avoid null values in module and change status services
This commit is contained in:
		| @@ -146,14 +146,17 @@ namespace Core.Thalos.Provider.Providers.Onboarding | ||||
|         /// <param name="newStatus">The new status of the user.</param> | ||||
|         /// <returns>A <see cref="{Task{UserAdapter}}"/> representing | ||||
|         /// the asynchronous execution of the service.</returns> | ||||
|         public async ValueTask<UserAdapter> ChangeUserStatus(string _id, Core.Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken) | ||||
|         public async ValueTask<UserAdapter?> ChangeUserStatus(string _id, Core.Blueprint.Mongo.StatusEnum newStatus, CancellationToken cancellationToken) | ||||
|         { | ||||
|             var entity = await repository.FindByIdAsync(_id); | ||||
|             entity.Status = newStatus; | ||||
|  | ||||
|             await repository.ReplaceOneAsync(entity); | ||||
|             if (entity is not null) | ||||
|             { | ||||
|                 entity.Status = newStatus; | ||||
|  | ||||
|             return entity; | ||||
|                 return repository.ReplaceOneAsync(entity).Result; | ||||
|             } | ||||
|             else return null; | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
| @@ -163,11 +166,10 @@ namespace Core.Thalos.Provider.Providers.Onboarding | ||||
|         /// <param name="_id">The User mongo identifier.</param> | ||||
|         /// <returns>A <see cref="{Task{UserAdapter}}"/> representing | ||||
|         /// the asynchronous execution of the service.</returns> | ||||
|         public async ValueTask<UserAdapter> UpdateUser(UserAdapter entity, CancellationToken cancellationToken) | ||||
|         public async ValueTask<UserAdapter?> UpdateUser(UserAdapter 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