Testing ModelBinder
To test it, we need to create a new request in Postman:
- Start the application by running
dotnet run
in the console or by pressing F5 in Visual Studio or VS Code. - In Postman, we will then set the request type to POST and insert the URL
https://localhost:5001/api/persons
in the address bar.
The port number might vary on your side.
- Next, we need to add the CSV data to the body of the request. Select
form-data
as the body type, add thepersons
key, and paste the following value lines in the value field:Id,FirstName,LastName,Age,EmailAddress,Address,City,Phone 48,Austin,Ward,49,Jake.Timms@live.com,"8814 Gravesend Neck Road ",Daly City,(620) 260-4410 2,Sierra,Smith,15,Elizabeth.Wright@hotmail.com,"1199 Marshall Street ",Whittier,(655) 379-4362 27,Victorina,Radcliff,40,Bryce.Sanders@rogers.ca,"2663 Sutton Street ",Bloomington,(255) 365-0521
- After pressing Send, we get the result, as shown in Figure 13.2: ...