Create a model folder(Models)
Step1:
Inside Models folder
Create a Department class Department.cs
Step2 :
Create a Employee.cs class with in folder
Step 3:
Create a employee context class inside models folder EmployeeContext
//This class will be called inside controller i.e employee controller for our post and put method.
Step4 : Create another class NewCollector
Step5:
Inside our Startup.cs class
Step6 : Inside our package manager console
Add-migration Initial
UpdateDatabase
Step7:
Create a controllers class replace with this :
Step8:
Run the application
Use this For GEt : http://localhost:49465/api/employees
Use this for POST : http://localhost:49465/api/employees
and select body >> raw >> json (Application/json)>>
and add this
Use this for put method :
Use this for delete : http://localhost:49465/api/employees/8
That’s all thank’s keep supporting. 😀