View
Create a quick view
- In the Solution Explorer pane of the PhotoSharingApplication - Microsoft Visual Studio window, right-click Controllers, point to Add, and then click Controller.
- In the Controller name box of the Add Controller dialog box, type PhotoController.
- In the Template list, click MVC Controller with read/write actions and views, using Entity Framework.
- In the Model class list, click Photo (PhotoSharingApplication.Models).
- In the Data context class list, click PhotoSharingContext (PhotoSharingApplication.Models).
- In the Views list, ensure that the Razor (CSHTML) view is selected, and then click Add.
Partial View
- Invoke the page with @Html.Action("_PhotoGallery", "Photo")
@model PhotoSharingApplication.Models.Photo
@{
ViewBag.Title = "Display";
}
<title> Photo: @Model.Title </title>
<h2>"@Model.Title"</h2>
<img width="800" src="@Url.Action("GetImage", "Photo", new { id = Model.PhotoID }) " />
<p>
@Html.DisplayFor(model => model.Description)
</p>
<p>
@Html.DisplayNameFor(model => model.UserName):
@Html.DisplayFor(model => model.UserName)
</p>
<p>
@Html.DisplayNameFor( model => model.CreatedDate):
@Html.DisplayFor( model => model.CreatedDate)
</p>
<p>
@Html.ActionLink("Back to List", "Index")
</p>
Comentarios
Publicar un comentario