Join Jess Chadwick for an in-depth discussion in this video Solution, part of Learn ASP.NET Core MVC: The Basics.
- [Instructor] In order to solve this challenge,…you needed to convert the SpecialsDataContext…into an entity framework DbContext…and then add an I.D. field to the Special class…to act as its primary key in the database.…Notice how I updated the existing…get monthly specials method to just…return the collection of Specials from the database.…Creating methods like this on your Db context classes…is not only supported, I'd encourage it.…
You also needed to configure the context…in just the way that I configured the blog data context.…First, remove the old registration…for the SpecialsDataContext…and replace it with an AddDbContext registration…and finally, you needed…to run the application at least one time,…so that entity framework would create the database for you.…
Once the database is created,…you can go in and add all…of the Specials data that you like.…With the data in place, you can go back, refresh the page,…and there you have it.…No more hard-coded Specials data.…Now that I've shown you the solution for this challenge,…
- Building blocks of ASP.NET Core applications
- Creating a new project
- Responding to HTTP requests
- Serving static files
- Understanding the MVC pattern
- Handling requests with controllers
- Rendering HTML with Razor
- Rendering data, view markup, and view logic
- Creating HTML forms
- Validating form data
- Reading and writing from a database with Entity Framework
- Improving the user experience
- Exposing data with a web API
- Securing your ASP.NET application
Skill Level Intermediate
1. The Basics
2. The Model-View-Controller (MVC) Pattern
Understand routing4m 24s
3. Render HTML with Views
4. Work with Data
5. Improve User Experience with Ajax and Web APIs
6. Secure Your Application
Next steps1m 42s
- 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.