I have a table with several records and a delete link, how do I, when I click on this link, pass the value of the record id I want to delete? Code of my view:
@model IList<Financas.Entidades.Usuario>
@Html.ActionLink("Novo Usuário", "Form")
<table class="table table-hover">
<thead>
<tr>
<th>Id</th>
<th>Nome</th>
<th>E-mail</th>
</tr>
</thead>
<tbody>
@foreach(var usuario in Model)
{
<tr>
<td>@usuario.Id</td>
<td>@usuario.Nome</td>
<td>@usuario.Email</td>
<td>@Html.ActionLink("Excluir","Excluir","Usuario")</td>
</tr>
}
</tbody>
</table>
Controller:
public ActionResult Excluir(int? usuario)
{
try
{
IList<Usuario> dados = usuarioDAO.GetById(usuario);
return View(dados);
}
catch (Exception)
{
throw;
}
}