Example #1
0
        public IActionResult Index([FromForm] Login login)
        {
            //HttpContext.Session.SetString("Test", "Ben Rules!");
            ViewData["Api"] = _endPoint;
            var ad        = new AdaptadorAtc(_configuration);
            var ipaddress = _accessor.HttpContext.Connection.RemoteIpAddress.ToString();
            var us        = ad.UsuariosLogin(login.email, login.password, ipaddress);

            if (us.IdUsuarioWeb > 0)
            {
                us.InfoMenuWeb  = ad.InfoMenuWebLeer();
                us.Mensajes     = ad.MensajeLeer(us.Cliente.IDCliente, 0);
                us.DatosEmpresa = ad.DatosEmpresaLeer(us.IdUsuarioWeb);
                HttpContext.Session.SetObjectAsJson("Login", us);

                var vm = new IndexViewModel(_configuration);
                ViewData["Vehiculos"] = vm.Vehiculos;
                ViewData["UnClick"]   = vm.UnClick;
                ViewData["Novedades"] = vm.Novedades;
                ViewData["Test"]      = HttpContext.Session.GetString("Test");
                ViewData["Usuario"]   = HttpContext.Session.GetObjectFromJson <UsuarioWeb>("Login");
                return(View());
            }
            else
            {
                //var msj = new MensajeError();
                return(RedirectToAction("Incorrecta", _defaultController));
            }
        }
Example #2
0
        private EmpresaWeb ConsultarDatosEmpresa()
        {
            var ad    = new AdaptadorAtc(_configuration);
            var dempr = ad.DatosEmpresaLeer();

            HttpContext.Session.SetObjectAsJson("EmpresaWeb", dempr);
            return(dempr);
        }