从邮递员调用apiController方法时,遇到了一个问题。
Postman客户端调用下面提到的带有参数的方法
[AllowAnonymous]
[HttpPost]
public IActionResult Register([FromBody]UserDto userDto)
{
// map dto to entity
//var user = _mapper.Map<User>(userDto);
return Ok(new
{
userDto
});
//try
//{
// // save
// _userService.Create(user, userDto.Password);
// return Ok();
//}
//catch (AppException ex)
//{
// // return error message if there was an exception
// return BadRequest(new { message = ex.Message });
//}
}
映射UserDto。
public class UserDto
{
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Username { get; set; }
public string Password { get; set; }
}
但我却收到以下错误: