yavsc/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Delete.cshtml

82 lines
1.8 KiB
Plaintext

5 years ago
@inherits Microsoft.Extensions.CodeGeneration.Templating.RazorTemplateBase
@using Microsoft.Extensions.CodeGeneration.EntityFramework
@@model @Model.ViewDataTypeName
@{
if (Model.IsPartialView)
{
}
else if (Model.IsLayoutPageSelected)
{
@:@@{
2 years ago
@:ViewData["Title"] = @@Model.ViewName"];
5 years ago
if (!string.IsNullOrEmpty(Model.LayoutPageFile))
{
@:Layout = "@Model.LayoutPageFile";
}
@:}
@:
2 years ago
@:<h2>@@Model.ViewName"]</h2>
5 years ago
@:
}
else
{
@:@@{
2 years ago
@:Layout = "null";
5 years ago
@:}
@:
@:<!DOCTYPE html>
@:
@:<html>
@:<head>
@:<meta name="viewport" content="width=device-width" />
2 years ago
@:<title>@@@Model.ViewName</title>
5 years ago
@:</head>
@:<body>
@:
// PushIndent(" ");
}
}
2 years ago
<h3>@AreYourSureYouWantToDeleteThis</h3>
5 years ago
<div>
2 years ago
<h4>@@@Model.ViewDataTypeShortName</h4>
5 years ago
<hr />
<dl class="dl-horizontal">
@{
foreach (var property in Model.ModelMetadata.Properties)
{
if (property.Scaffold && !property.IsPrimaryKey && !property.IsForeignKey)
{
<dt>
@@Html.DisplayNameFor(model => model.@GetValueExpression(property))
</dt>
<dd>
@@Html.DisplayFor(model => model.@GetValueExpression(property))
</dd>
}
}
@:</dl>
@:
@:<form asp-action="@Model.ViewName">
@:<div class="form-actions no-color">
2 years ago
@:<input type="submit" value="@Delete" class="btn btn-default" /> |
@:<a asp-action="Index">Back to List</a>
5 years ago
@:</div>
@:</form>
@:</div>
if (!Model.IsPartialView && !Model.IsLayoutPageSelected)
{
//ClearIndent();
@:</body>
@:</html>
}
}
@functions
{
string GetValueExpression(PropertyMetadata property)
{
//Todo: Get the association for the property and use that.
return property.PropertyName;
}
2 years ago
}