@model CityResponse
@* Generated from Custom MVC Template. *@
@* Model namespace using directive should be added to _ViewImports.cshtml. *@
@{
var containerDivClass = "container"; // "container-fluid" can be used for full width
}
@{
/*
ViewBag and ViewData are the same collection (dictionary).
They carry extra data other than the model from a controller action to its view, or between views.
The value assigned will be shown in Views\Shared\_Layout.cshtml view's title tag of the head tag.
*/
ViewData["Title"] = "City Delete";
}
<div class="@containerDivClass">
<h1>@ViewData["Title"]</h1>
<hr />
</div>
@if (Model is not null)
{
<div class="@containerDivClass">
@if (TempData["Message"] is not null)
{
/*
TempData is used to carry extra data to the redirected controller action's view.
*/
<p class="text-danger">
@TempData["Message"]
</p>
}
<h3 class="text-danger">Are you sure you want to delete?</h3>
<hr />
<div class="row mb-3">
<div class="col-2 fw-bold">
@Html.DisplayNameFor(model => model.CityName)
</div>
<div class="col-10">
@Html.DisplayFor(model => model.CityName)
</div>
</div>
<div class="row mb-3">
<div class="col-2 fw-bold">
@Html.DisplayNameFor(model => model.Country)
</div>
<div class="col-10">
@Html.DisplayFor(model => model.Country.CountryName)
</div>
</div>
<div class="row mb-3">
<div class="col-2 fw-bold">
@Html.DisplayNameFor(model => model.FilePath)
</div>
@if (string.IsNullOrWhiteSpace(Model.FilePath))
{
<div class="col-5">
<span><i class="bx bx-image" style="font-size:xx-large;"></i></span>
</div>
}
else
{
<div class="col-7">
<img src="@Model.FilePath" class="d-block img-fluid" />
</div>
<div class="col-3">
<a asp-action="DeleteFile" asp-route-id="@Model.Id" asp-route-filePath="@Model.FilePath" class="text-danger">Delete File</a>
</div>
}
</div>
@* Can be uncommented and used for many to many relationships, "entity" may be replaced with the related entity name in the controller and views.
Raw HTML Helper is used in case string parameter may have HTML tags. *@
@*
<div class="row mb-3">
<div class="col-2 fw-bold">
<b>@Html.DisplayNameFor(model => model.Entitys)</b>
</div>
<div class="col-10">
@Html.Raw(Model.Entitys)
</div>
</div>
*@
<hr />
<form asp-action="Delete">
@Html.AntiForgeryToken()
<input type="hidden" asp-for="Id" />
<input type="submit" value="Yes" class="btn btn-danger" />
<a asp-action="Index" class="btn btn-outline-danger">No</a>
</form>
</div>
}