@model Photo_Shared.Models.Photo

@{
    ViewBag.Title = "Details";
}

<h2>Details</h2>

<div>
    <h4>Photo</h4>
    <hr />
    <dl class="dl-horizontal">
        <dt>
            @Html.DisplayNameFor(model => model.Title)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.Title)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.PhotoFile)
        </dt>

        <dd>
            <td align="center">
                <img src="@Html.ViewBag.URL"
                     width="50%"
                     alt="" />
            </td>
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.Description)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.Description)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.CreatedDate)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.CreatedDate)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => model.Owner)
        </dt>

        <dd>
            @Html.DisplayFor(model => model.Owner)
        </dd>

    </dl>
</div>
<p>
    @Html.ActionLink("Edit", "Edit", new { id = Model.PhotoID }) |
    @Html.ActionLink("Back to List", "Index")
</p>

<p>
    @Html.ActionLink("Create New Comment", @Url.Content("~/") + "../Comments/Create", new { id = Model.PhotoID }))
</p>
<table class="table">
    <tr>
        <th>
            Owner
        </th>
        <th>
            Subject
        </th>
        <th>
            Body
        </th>
        <th></th>
    </tr>

    @foreach (var item in Model.Comments) {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.photo.Title)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Owner)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Subject)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Body)
            </td>
            <td>
                @Html.ActionLink("Edit", @Url.Content("~/") + "../Comments/Edit", new { id = item.CommentID }) |
                @Html.ActionLink("Delete", @Url.Content("~/") + "../Comments/Delete", new { id = item.CommentID })
            </td>
        </tr>
}

</table>
