Exemplo n.º 1
0
        public IActionResult OnGet([FromServices] ObterEnderecos.QueryHandler handler)
        {
            string sessionCpf = HttpContext.Session.GetString("CpfCliente");

            if (!string.IsNullOrWhiteSpace(sessionCpf))
            {
                Enderecos = handler.Handle(sessionCpf);
                return(Page());
            }

            return(Redirect("/Cliente"));
        }
Exemplo n.º 2
0
        public IActionResult OnPostSelecionar(int enderecoId
                                              , [FromServices] ObterEnderecos.QueryHandler handler
                                              , [FromServices] SelecionarEndereco.CommandHandler commandHandler)
        {
            string sessionCpf = HttpContext.Session.GetString("CpfCliente");

            if (!string.IsNullOrWhiteSpace(sessionCpf))
            {
                commandHandler.Handle(sessionCpf, enderecoId);

                return(OnGet(handler));
            }

            return(Redirect("/Cliente"));
        }