This post is about the server side controller implementation. If you’re using previous versions of ASP.NET, you need to use Web API or REST enabled WCF services. ASP.NET5 comes with unified development experience, so don’t need to specify whether it is an MVC controller or Web API controller. You only need to inherit from controller class. It is also optional, since controller class got some utility methods, in this post, the controller is inherited from Controller class. Also for storage, I am using EF InMemory provider, you can use Sqlite or SqlServer, only minimal change is required. Here is the project.json file.
Here is the Startup.cs class ConfigureServices() method. In this I am adding MVC and configuring the EF InMemory database.
DbContext and model class implementation is like this.
And here is the Controller implementation. For update and delete you can specify PUT and DELETE attributes, but in this post I am using HTTP POST action only.
In the next post I will cover about the client side changes.
What do you think? I would like to hear your thoughts, suggestions, and questions in the comments section below.
Did you like this article? Share it with your friends