From the course: Building Angular and ASP.NET Web API Apps
Unlock this course with a free trial
Join today to access over 24,600 courses taught by industry experts.
Cleanup Code
From the course: Building Angular and ASP.NET Web API Apps
Cleanup Code
- [Instructor] In this part we're going to clean up the transactions controller and for that let us go to Visual Studio. Now the reason why we need to clean up the controller is because in the actions within this controller we do also have some logic like for example, we get the data from the database, we then update the data, we send the data back to the database and then we just return a response. A controller action is not supposed to do this kind of stuff. The database interaction should always be done by a different file and in an action we should only have the request received. So we just get the request, we process the request inside here and then just return a response to the user. So the actions within a controller should always be as simple as possible. When we have database access, we should always remove this logic from here to a different file. For these files we use a different name. We call these files the services of an app. So for that let us just go to the solution…
Contents
-
-
-
-
Create an empty Web API Project9m 4s
-
(Locked)
Define application models5m 47s
-
(Locked)
Configure entity framework for database access13m 55s
-
(Locked)
Build the Create API endpoint10m 41s
-
(Locked)
Create the read-all API endpoint3m 4s
-
(Locked)
Create the read by ID API endpoint6m 55s
-
(Locked)
Create the update API endpoint7m 4s
-
(Locked)
Create the delete API endpoint3m 10s
-
(Locked)
Cleanup Code16m 24s
-
-
-
-
-