From 7a5bf145e487b0e823f14699aee474e5555b4a32 Mon Sep 17 00:00:00 2001 From: raczu Date: Sun, 9 Jun 2024 22:40:40 +0200 Subject: [PATCH] refactor: remove redundant null checks --- .../ReasnAPI/Services/Authentication/AuthService.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Server/ReasnAPI/ReasnAPI/Services/Authentication/AuthService.cs b/Server/ReasnAPI/ReasnAPI/Services/Authentication/AuthService.cs index c59f47e8..4130025b 100644 --- a/Server/ReasnAPI/ReasnAPI/Services/Authentication/AuthService.cs +++ b/Server/ReasnAPI/ReasnAPI/Services/Authentication/AuthService.cs @@ -3,6 +3,7 @@ using ReasnAPI.Models.Database; using ReasnAPI.Models.Enums; using ReasnAPI.Services.Exceptions; +using Exception = System.Exception; namespace ReasnAPI.Services.Authentication; @@ -58,7 +59,7 @@ public User Register(RegisterRequest request) Email = request.Email, Username = request.Username, Role = Enum.Parse(request.Role), - Phone = !string.IsNullOrEmpty(request.Phone) ? request.Phone : null, + Phone = request.Phone, IsActive = true, CreatedAt = DateTime.UtcNow, UpdatedAt = DateTime.UtcNow, @@ -68,8 +69,7 @@ public User Register(RegisterRequest request) City = request.Address.City, Street = request.Address.Street, State = request.Address.State, - ZipCode = !string.IsNullOrEmpty(request.Address.ZipCode) ? - request.Address.ZipCode : null + ZipCode = request.Address.ZipCode } }; _context.Users.Add(user);