@using MvcSample.Web.Models
@model User
@{
string nullValue = null;
ViewBag.Title = (Model == null) ? "Create Page" : "Edit Page";
if (ViewData["Gift"] == null)
{
ViewBag.Gift = "nothing";
}
}
@ViewBag.Title
Thanks for @ViewBag.Gift
@if (Model == null)
{
Howdy, your model is null.
}
else
{
Hello @Model.Name! Happy @Model.Age birthday.
}
@{
var metadata = ViewData.ModelMetadata;
if (metadata != null)
{
var typeName = metadata.ModelType.Name;
var description = metadata.Description;
@typeName has description '@description' and contains
@foreach (var property in metadata.Properties)
{
var propertyName = property.PropertyName;
var propertyTypeName = property.ModelType.Name;
var propertyDescription = property.Description;
- Property @propertyName has type @propertyTypeName and description '@propertyDescription'
}
}
}