15.0: API Controller
Last updated
Last updated
Stop the app
Right click on ElevenNote.WebApi -> Controllers and click Add -> Controller
Select Web Api 2 Controller - Empty
Name it NoteController(or whatever your controller needs to be named if this is an alternative app)
Add an [Authorize]
attribute tag at the top
Inside the controller, add a helper method that creates a NoteService
similar to our method in the ElevenNote.Web
MVC project
CTRL .
to bring in the using statement for the NoteService
project and Microsoft.Asp.Net.Identity
This will allow us to reuse our NoteService
in the methods for the API project, much like we did in the MVC project
Above the service method, write a method that uses the Service:
CTRL .
to bring in the using statement and then consider doing a
Next, we'll test getting notes in Postman.