Ejemplo n.º 1
0
        public async Task <IActionResult> Logout()
        {
            bool hasValue = Request.Headers.TryGetValue(INVOKER_TOKEN_HEADER, out StringValues token);

            if (!hasValue || token.Count == 0)
            {
                return(new EmptyResult());
            }

            await SecurityServices.Logout(token[0]);

            return(new EmptyResult());
        }
Ejemplo n.º 2
0
        //public InteractionRequest<INotification> DisplayBookAdd { get; set; }

        /*
         * InteractionRequest es la manera que tiene la ui de avisarnos que existe un pedido del
         * usuario para por ejemplo mostrar unn dialogo
         * En este caso el tipo T es IConfirmation porque tengo que decir si acepto o no la ejecucion
         *
         * Para cada interaccion CASI SIEMPRE tambien tenemos que poner un comando
         */

        public MainWindowViewModel()
        {
            DisplayLogin = new InteractionRequest <INotification>();

            //DisplayBookAdd = new InteractionRequest<INotification>();

            Login = new RelayCommand(() =>
            {
                DisplayLogin.Raise(new Notification()
                {
                    Title   = "Ingreso al sistema",
                    Content = "Prueba"
                }, LoginTerminado);
            }, CanLogin);

            Logout = new RelayCommand(() =>
            {
                SecurityServices serv = new SecurityServices();

                serv.Logout();
                Usuario = null;
                Status  = null;
            }, CanLogout);

            NullCommand = new RelayCommand(() => { }, () => false);

            Buscar = new RelayCommand(() => BuscarTexto());

            ConfirmarComando = new InteractionRequest <IConfirmation>();

            //if (IsInDesignMode)
            //{
            //  Usuario = new Usuario()
            //  {
            //    Empleado = new Empleado()
            //    {
            //      Persona = new Persona() { Nombres = "Enrique", Apellidos = "Thedy" }
            //    }
            //  };
            //}
        }
Ejemplo n.º 3
0
        /*
         * InteractionRequest es la manera que tiene la ui de avisarnos que existe un pedido del
         * usuario para por ejemplo mostrar unn dialogo
         * En este caso el tipo T es IConfirmation porque tengo que decir si acepto o no la ejecucion
         *
         * Para cada interaccion CASI SIEMPRE tambien tenemos que poner un comando
         */

        public MainWindowViewModel()
        {
            DisplayLogin = new InteractionRequest <INotification>();

            Login = new RelayCommand(() =>            //RelayCommand es de MVVMLIte
            {
                DisplayLogin.Raise(new Notification() //esto es un iteraction request, nos muestra la ventanita login
                {
                    Title   = "Ingreso al sistema",
                    Content = "PRUEBA"
                }, LoginTerminado); // cuando termina llama a LoginTerminado(el cual chequea si la sesion es o no nula, si no lo es pone la variable login status en "LoginOK"
            }, CanLogin);           //interaccionrequest le dice al boton que muestre la ventana


            Logout = new RelayCommand(() =>
            {
                SecurityServices serv = new SecurityServices();

                serv.Logout();
                Usuario = null;
                Status  = null;
            }, CanLogout);

            NullCommand = new RelayCommand(() => { }, () => false);

            Buscar = new RelayCommand(() => BuscarTexto());

            ConfirmarComando = new InteractionRequest <IConfirmation>();

            //if (IsInDesignMode)
            //{
            //  Usuario = new Usuario()
            //  {
            //    Empleado = new Empleado()
            //    {
            //      Persona = new Persona() { Nombres = "Enrique", Apellidos = "Thedy" }
            //    }
            //  };
            //}
        }