I am creating an application where I use Windows Authentication to validate user data. As soon as the application opens, some information about that logged in user appears on the first page. In another menu I open all registered users.
How do I click on the user and open the same page that opens when I enter the application, but with the data of that user that I clicked?
This is the Index
of my PerfilController
which is where I get the information through the windows authentication that I want to display as soon as the user logs in to the application:
public ActionResult Index()
{
var chapa = UserDetails.GetChapa(User.Identity.Name);
var perfil = db.Perfis.FirstOrDefault(x => x.Chapa == chapa);
if (perfil == null)
{
return HttpNotFound();
}
ViewBag.Id = perfil.Id;
return View(perfil);
}
This is the view Relatorio
that I have where the list returns and position of the people that I have registered in the bank. I wanted to click "View Profile" and open the profile of that person I clicked.
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.Chapa)
</td>
<td>
@Html.DisplayFor(modelItem => item.Nome)
</td>
<td>
@Html.DisplayFor(modelItem => item.Cargo)
</td>
<td>
@* @Html.ActionLink("Edit", "Edit", new { id=item.Id }) *@|
@Html.ActionLink("Ver Perfil", "Details", new { id=item.Id }) |
@* @Html.ActionLink("Delete", "Delete", new { id=item.Id })*@
</td>
</tr>
}