From 40e422d778065470b7bbd984a16ecf60afa5b5fc Mon Sep 17 00:00:00 2001 From: Nestisse Date: Sun, 17 Mar 2024 11:29:53 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20de=20la=20m=C3=A9thode=20equals=20dans?= =?UTF-8?q?=20userdto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- API_SQLuedo/Dto/UserDTO.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/API_SQLuedo/Dto/UserDTO.cs b/API_SQLuedo/Dto/UserDTO.cs index e035608..d3aa536 100644 --- a/API_SQLuedo/Dto/UserDTO.cs +++ b/API_SQLuedo/Dto/UserDTO.cs @@ -36,21 +36,27 @@ public bool Equals(UserDto? other) { - if (object.ReferenceEquals(other, null)) + return (this.Id == other?.Id); + } + + public override bool Equals(object? obj) + { + if (object.ReferenceEquals(obj, null)) { return false; } - if (object.ReferenceEquals(this, other)) + if (object.ReferenceEquals(this, obj)) { return true; } - if (this.GetType() != other.GetType()) + if (this.GetType() != obj.GetType()) { return false; } - return (this.Id == other.Id); + + return this.Equals(obj as UserDto); } public override int GetHashCode()