public async Task <IActionResult> AuthenticateAsync([FromBody] UserInfo data) { try { string userName = data.UserId, password = data.Pwd; if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(password) || userName.Trim().Length != 16 || password.Trim().Length != 4) { //400 return(BadRequest()); } var user = await _bankService.FindUserAsync(userName, password); if (user != null) { //200 return(Ok(new { UserId = user.UserId, UserDisplayName = user.Name })); } else { //404 return(NotFound()); } } catch (Exception ex) { _logger.LogError(ex.Message); //500 return(StatusCode(Microsoft.AspNetCore.Http.StatusCodes.Status500InternalServerError, "Server Error.")); } }