I need help executing C# code with a button click. I`m sure there are multiple things wrong with this, however; any help would be much appreciated. Thank you for taking the time to view this post, and have a wonderful day!
@{
CommentController controller = new CommentController();
UpVotes Upvote = new UpVotes(Misc.GetUser(), c.Postid);
}
@{
if (controller.CheckVote(Upvote))
{
<button type="button" onclick="@{
c.Upvotes += 1;
controller.PersonUpVote(Upvote);
}
}">
Like
</button>
}
else
{
<button type="button" onclick="@{
controller.PersonDownVote(Upvote);
c.Upvotes -= 1;
}
}">
Unlike
</button>
}
}