public IActionResult Insert([FromBody] UserVM user) { if (user.UserName is null || user.Password is null) { return(BadRequest("value is null.")); } if (!ModelState.IsValid) { return(BadRequest()); } Tuple <AuthenticationResult, User> authResult = UserContract.AddUser(user.Name, user.FamilyName, user.UserName, user.Password, user.Email, user.BirthDate.Value); if (authResult.Item1.Code != AuthenticationResultCode.AuthenticationSuccess) { return(BadRequest( new FailedLoginResponseModel() { code = authResult.Item1.Code, authenticationResult = AuthenticationContract.GetAuthenticationResultMessage(authResult.Item1.Code, "fa-IR"), additionalInformation = authResult.Item1.AdditionalErrorMessage } )); } //return CreatedAtRoute("addUser", new { controller = "User", id = authResult.Item2.Id }, (User)authResult.Item2); return(Ok()); }