This video covers the changes from MVC 5 and Web API 2.2 in regards to controllers and actions.
- [Man] This section is pretty brief. I just want to call out the differences between prior versions and ASP.NET Core. And a lot of these have already been mentioned but it's worth calling them out again. So in ASP.NET Core we only have controllers. AsyncController and APIController are all supported now by just one class called Controller. All action methods on the Controller class return in IActionResult or Task of IActionResult or a derivative of IActionResult.
And this is different than prior where it might return an IActionResult or if it was an API style method, an IHttpActionResult. So it's all been consolidated into one. There's also a whole host of additional helper methods built into the base controller class. For example, NoContent, OK, BadRequest. You don't have to remember the different HttpStatusCodes, you can call this helper method to return the appropriate content.
Another change between Web API and ASP.NET Core is that in Web API 2.2, you could name your action method based on the HTTP verb it represented, so get, post, put, delete, and the framework would automatically know which type of verb to execute. Well, I think it's a good thing that's gone. Little too much tribal knowledge in my taste. Now you just have to specifically call out the HTTP verb that is supported by that method.
Other than those few changes, all of the knowledge that you have about MVC and Web API carries right over into the controllers and actions.
- Running and debugging ASP.NET Core applications
- Pros and cons of migrating existing applications to ASP.NET Core.
- Built-in dependency injection
- Environment awareness and app configuration
- Web host configuration and SSL
- View components invoked as tag helpers
- Configuration and logging
- Using Razor Pages
Skill Level Intermediate
Set up the sample projects4m 48s
1. Get to Know .NET Core
2. ASP.NET Core 1.0
3. ASP.NET Core 1.1
4. ASP.NET Core 2.0
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.