I have the code below, and to call the session that stores the user data, only once do I want to put it in the controller declaration.
Doubt
The variable usuarioLogado
is per request or it can happen that user X calls the controller and in the middle user Y calls the same controller, and usuarioLogado
information exchange, where should read user X, step the user Y.
Code
public class AppRequisitoController : Controller
{
string controller = "AppRequisito";
UsuarioLogadoDTO usuarioLogado = Services.UsuarioService.SessaoUsuarioLogado();
private void Listagem(Conexao db)
{
var repAppRequisito = new AppRequisitoRepositorio(db);
ViewBag.ListaAppRequisito = repAppRequisito.ComboBox(usuarioLogado);
}
User session
public static UsuarioLogadoDTO SessaoUsuarioLogado()
{
return HttpContext.Current.Session[Constantes.sessaoUsuarioLogado] as UsuarioLogadoDTO;
}