From the course: Building Applications with Angular, ASP.NET Core, and Entity Framework Core
Unlock the full course today
Join today to access over 22,700 courses taught by industry experts or purchase this course individually.
Create a get route
From the course: Building Applications with Angular, ASP.NET Core, and Entity Framework Core
Create a get route
- [Instructor] In our backend project, let's create an endpoint that will serve a list of questions. We will start by copying the get function from the values example controller. So let's open that up. Let's copy everything between line 13 and line 17. Then let's post that in above our post endpoint. Then let's modify the function. For our return, instead of string, we'll use Models.Question and we'll also return a new Models.Question. Let's get rid of the values and create the new Models.Question and initialize it with text and a placeholder value. Let's copy this line and paste it below. And we'll do that one more time. Let's save this and give it a try in our browser. Then let's navigate to our questions URL and we can see we're getting the list of questions. Now that we're able to get and post data, let's look at how to save it and make it persist with Entity Framework Core.
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.