I have a view that list my users, it's basically in the default generated by asp.net mvc with entity, the data is in a table, and inside this table I have one:
@Html.ActionLink("Aprovar cadastro", "Aprovar")
And I have within the controller Action:
[HttpGet]
public ActionResult Aprovar(int? Id)
{
if(Id == null){return new HttpStatusCodeResult(HttpStatusCode.BadRequest);}
else {
//A função será implementada aqui
}
}
Basically I need to pass the ID of a specific user to this controller, but I'm not getting success.
Follow my view:
@model IEnumerable<ApegaPet.Models.ApplicationUser>
@{ Layout = "~/Views/Shared/_SideNavbar.cshtml"; }
@{
ViewBag.Title = "Avaliar_Ong";
}
<h2>Avaliar requisição de cadastro de Ongs</h2>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.nomerazao)
</th>
<th>
@Html.DisplayNameFor(model => model.endereco)
</th>
<th>
@Html.DisplayNameFor(model => model.telefone)
</th>
<th>
@Html.DisplayNameFor(model => model.Name)
</th>
<th>
@Html.DisplayNameFor(model => model.Email)
</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.nomerazao)
</td>
<td>
@Html.DisplayFor(modelItem => item.endereco)
</td>
<td>
@Html.DisplayFor(modelItem => item.telefone)
</td>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.Email)
</td>
<td>
@Html.ActionLink("Aprovar cadastro", "Aprovar")
</td>
</tr>
}
</table>