Skip to content

Commit

Permalink
refactor: remove redundant null checks
Browse files Browse the repository at this point in the history
  • Loading branch information
raczu committed Jun 9, 2024
1 parent f732b6c commit 7a5bf14
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using ReasnAPI.Models.Database;
using ReasnAPI.Models.Enums;
using ReasnAPI.Services.Exceptions;
using Exception = System.Exception;

namespace ReasnAPI.Services.Authentication;

Expand Down Expand Up @@ -58,7 +59,7 @@ public User Register(RegisterRequest request)
Email = request.Email,
Username = request.Username,
Role = Enum.Parse<UserRole>(request.Role),
Phone = !string.IsNullOrEmpty(request.Phone) ? request.Phone : null,
Phone = request.Phone,
IsActive = true,
CreatedAt = DateTime.UtcNow,
UpdatedAt = DateTime.UtcNow,
Expand All @@ -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);
Expand Down

0 comments on commit 7a5bf14

Please sign in to comment.