Issue
I have been given a piece of code that was written years ago by someone else and I am trying to get my head around why this piece of code is not working.
I have a Edit.aspx page which inside has a list of hyperlinks and one of these links is a Delete label, but has a RenderPartial in it's place (See Below):
<% Html.RenderPartial("UserDeleteLink", Model); %>
Inside the UserDeleteLink.ascx page it contains the delete button:
<li>
<% using (Html.BeginForm("Delete", "User", new { id = Model.uID }, FormMethod.Post, new { id = "DeleteForm" }))
{ %>
<a class="delete-user-button expired" href="javascript:void(0);"><%: Resources.GeneralDelete %></a>
<% } %>
</li>
Now inside the UserController.cs it has a method which deletes the record from the database:
[HttpPost, ActionName("Delete")]
[RequireAdminAttribute]
[Authorize]
public ActionResult DeleteConfirmed(int id)
{
_userRepository.Delete(id);
_userRepository.Save();
return RedirectToAction("Index", "Admin");
}
The problem is that the method is not getting hit, and I can't seem to debug the issue.
Can anyone see the issue?
<%: Resources.GeneralDelete %>is "Delete" just in a Resource file.