Books/Details.cshtml
|
@model BookStore1.Models.Book @{ ViewData["Title"] = "Details"; } <h1>Details</h1> <div> <h4>Book</h4><hr /> <dl class="row"> <dt class = "col-sm-2"> @Html.DisplayNameFor( model => model.Title ) </dt> <dd class = "col-sm-10"> @Html.DisplayFor( model => model.Title ) </dd> <dt class = "col-sm-2"> @Html.DisplayNameFor( model => model.Genre ) </dt> <dd class = "col-sm-10"> @Html.DisplayFor( model => model.Genre ) </dd> <dt class = "col-sm-2"> @Html.DisplayNameFor( model => model.Price ) </dt> <dd class = "col-sm-10"> @Html.DisplayFor( model => model.Price ) </dd> <dt class = "col-sm-2"> @Html.DisplayNameFor( model => model.PublishDate ) </dt> <dd class = "col-sm-10"> @Html.DisplayFor( model => model.PublishDate ) </dd> </dl> </div> <div> <a asp-action="Edit" asp-route-id="@Model?.Id">Edit</a> | <a asp-action="Index">Back to List</a> </div> |
@Model?.Id
is used to safely access the Id
property of the Model
object, even if Model
is null.
āIām dating a homeless woman. It was easier talking her into staying over.ā — Garry Shandling |