8.1: Detail View
Create the Detail View
In order to physically see the NoteDetail model on our webpage, we need to create a view for it.
Open
NoteController.csThe error is gone since we added the
GetNoteById()method inNoteService.csRight click on the
Details()method and add a viewFill it out like this:

ActionLinks
In the
Details.cshtmlfile that was created, change theActionLinks at the bottom to:</div> <p> @Html.ActionLink("Edit", "Edit", new { id = Model.NoteId }) | @Html.ActionLink("Back to List", "Index") </p>Go to Views -> Notes -> Index.cshtml
Change the
ActionLinks at the bottom to:</td> <td> @Html.ActionLink("Edit", "Edit", new { id=item.NoteId }) | @Html.ActionLink("Details", "Details", new { id=item.NoteId }) | @Html.ActionLink("Delete", "Delete", new { id=item.NoteId }) </td> </tr> }
These anonymous classes inside the
ActionResultwill communicate to theNoteControllerand 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.
Last updated