Avoid NREs in MVC sample
- see e.g. results of `GET ~/Home/Post` - use parentheses to avoid `?` confusing Razor nit: remove unused Home/Test.cshtml view
This commit is contained in:
parent
e54bf866e0
commit
ab8a77bb70
|
|
@ -26,7 +26,7 @@
|
|||
if (metadata != null)
|
||||
{
|
||||
var typeName = metadata.ModelType.Name;
|
||||
var description = metadata.Description;
|
||||
var description = metadata.Description ?? "no description";
|
||||
<p>@typeName has description '@description' and contains</p>
|
||||
<ul>
|
||||
@foreach (var property in metadata.Properties)
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
Hello From Razor
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
@using MvcSample.Web.Models
|
||||
@model User
|
||||
|
||||
<strong>Hello @Model.Name from Partial</strong>
|
||||
<strong>Hello @(Model?.Name) from Partial</strong>
|
||||
|
||||
<a href="@Url.Action("Create", "Home")">Create Something!</a>
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
<p><a href="http://asp.net" class="btn btn-primary btn-large">Learn more »</a></p>
|
||||
</div>
|
||||
<div class="row">
|
||||
<h3 title="@Model.Name" class="@nullValue">Hello @Html.DisplayTextFor(User => User)! Happy @Model.Age birthday.</h3>
|
||||
<h3 title="@(Model?.Name)" class="@nullValue">Hello @Html.DisplayTextFor(User => User)! Happy @(Model?.Age) birthday.</h3>
|
||||
<h3 id="qux">This value was retrieved asynchronously: @(await AsyncValueRetrieval())</h3>
|
||||
<h3>Partial Async: @await Html.PartialAsync("HelloWorldPartial", Model)</h3>
|
||||
<h3>
|
||||
|
|
|
|||
Loading…
Reference in New Issue