hn-dotnet/Apps/Website/Views/Shared/_CommentForm.cshtml
2020-12-22 10:47:22 +01:00

21 lines
564 B
Plaintext

@model HN.Application.CommentLinkCommand
<div>
<h3 class="add-a-comment">Add a comment</h3>
@if (User.Identity.IsAuthenticated)
{
<form class="form" asp-action="Create" asp-controller="Comments" method="post">
<div class="field">
<input type="hidden" asp-for="@Model.LinkId" />
<textarea asp-for="@Model.Content"></textarea>
<span asp-validation-for="@Model.Content"></span>
</div>
<button type="submit">Post a comment</button>
</form>
}
else
{
<p>Only logged in users can comment.</p>
}
</div>