63 lines
1.3 KiB
Plaintext
63 lines
1.3 KiB
Plaintext
@using ForumContracts.ViewModels
|
|
|
|
@model List<AnswerViewModel>
|
|
|
|
@{
|
|
ViewData["Title"] = "Answer Page";
|
|
}
|
|
|
|
<div class="text-center">
|
|
<p>
|
|
@if(Model.Count > 0){
|
|
<h1>@Model[0].QuestionText</h1>
|
|
<h5>@Model[0].QuestionCreateDate</h5>
|
|
}
|
|
</p>
|
|
<h1 class="display-4">Ответы</h1>
|
|
</div>
|
|
|
|
|
|
<div class="text-center">
|
|
@{
|
|
if (Model == null)
|
|
{
|
|
<h3 class="display-4">Авторизируйтесь</h3>
|
|
return;
|
|
}
|
|
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>
|
|
Дата ответа
|
|
</th>
|
|
<th>
|
|
Ответ
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var item in Model)
|
|
{
|
|
<tr>
|
|
<td>
|
|
@Html.DisplayFor(modelItem => item.ResponseDate)
|
|
</td>
|
|
<td>
|
|
@Html.DisplayFor(modelItem => item.AnswerDes)
|
|
</td>
|
|
<td>
|
|
@if (APIClient.User.Id == item.UserId)
|
|
{
|
|
<form action="DeleteAnswer" method="post">
|
|
<input type="hidden" name="answerId" value="@item.Id"/>
|
|
<button type="submit" class="btn btn-danger">Удалить</button>
|
|
</form>
|
|
}</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
}
|
|
</div>
|