Hello I need to pass a data from one view to another, but I can not get it. Someone could please tell me the most appropriate way to send data. In this case my data is being obtained from another function and I need to know how to pass it is a int that I occupy as id
This is the view of which I want to send my data
//vista index
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
@Html.ActionLink("Check Request", "Details", "Request", new { id = 123 })
I need to go through this control and return it in the view Details
[Authorize]
public ActionResult Details(int id)
{
ViewBag.Id = id;
return View();
}
@{
ViewBag.Title = "Detalles - Cotización";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h1> Tu Id es: @ViewBag.Id </h1>