- Create a Database on Local db called ContactsAPISample
- View-> Sql Server Object Explorer in Visual Studio
- Add (localdb)\MSSQLLocalDB server if it does not exist
- Right click databases node under (localdb)\MSSQLLocalDB
- Add New database called ContactsAPISample
- Go to .Net Core 2.1 downloads and install the latest sdk and Runtime & Hosting Bundle
- Right click Solution and choose Restore Nuget Packages
- Open Package manager console in visual studio Tools-> Nuget Package Manager-> Package Manager Console
- Run Update-Database
Press F5. You will see a swagger page show. This will allow you to play with the different endpoints.
Create a contact (POST) and then run the other api end points. Try things like invalid input, duplicate email addresses, Birthdate in future.
This is a quick and dirty and not how I would create a good api. See below
- I did not use automapper and create API models to translate back and forth between enity framework and api models.
- I did not create a controller for email addresses.
- I did not use odata to allow the client to control things like filtering and such