8.1: Detail View
Last updated
Last updated
In order to physically see the NoteDetail
model on our webpage, we need to create a view for it.
Open NoteController.cs
The error is gone since we added the GetNoteById()
method in NoteService.cs
Right click on the Details()
method and add a view
Fill it out like this:
In the Details.cshtml
file that was created, change the ActionLink
s at the bottom to:
Go to Views -> Notes -> Index.cshtml
Change the ActionLink
s at the bottom to:
These anonymous classes inside the ActionResult
will communicate to the NoteController
and select the appropriate Note.
Run the app and go to the details view on one of the notes:
Do you see that URL localhost:59641/Note/Details/4? Next, we'll cover the components of it.