From the course: Building Angular and ASP.NET Web API Apps
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Getting data from the database
From the course: Building Angular and ASP.NET Web API Apps
Getting data from the database
- [Instructor] We have already created our model, then we created the layer or the DbContext file, which we are going to use to interact with our database. Now we are going to create our first controller. And within this controller, we are going to create an action which is going to return from the database all the entries that we have. So let's go to our solution and create our first controller and action. In your Solution Explorer, to create a controller, right click on the Controllers folder. And then go Add, Controller. Down here you have two options. You can either create an MVC controller or you can create a web API controller. We are going to use the web API option, because we want to get some data from the database and then return this data to our frontend, which is going to be built on top of Angular 6. So in here, we choose the Web API 2 Controller - Empty, and then click Add. Next, provide the name for your controller, and I am going to name my controller EntriesController,…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.