public async Task <ActionResult> Register([FromBody] RegisterDto model) { if (!ModelState.IsValid) { return(BadRequest(ModelState.ValidationState)); } JwtModel token = null; try { var checkMail = await _authRepo.ExsitEmail(model.Email); if (checkMail) { return(BadRequest(new { Error = "Email already exist" })); } token = await _authRepo.Register(model); if (token == null) { return(BadRequest("Password is not strong enough")); } } catch (Exception e) { _logger.LogError(e.InnerException?.ToString() ?? e.Message); return(StatusCode(StatusCodes.Status500InternalServerError, "Internal Server Error")); } return(Ok(token)); }