Hello, I have a method to log in to the system, right after I need the user to select an option in a dropdown and save that value in a session. Now I need to put the value stored in the session, inside a LINQ query. I'll post the codes, which will understand better.
Method to store the data in a session:
public ActionResult Contrato()
{
var contrato = new Usuario() { SqContrato = 0 };
return View(contrato);
}
[HttpPost]
public ActionResult Contrato(Int16? Contrato)
{
System.Web.HttpContext.Current.Session["Contrato"] = Contrato;
return View();
}
Method where I need to put the value stored by the session:
public ViewResult Ferias()
{
var usuarios =
funcionarioFeriasRepository.Lista.Where(r => r.slogin == autenticacaoProvider.UsuarioAutenticado.Login && r.SqContrato == "SESSION AQUI"
.ToList();
return View(usuarios);
}