Exemplo n.º 1
0
        public bool ConsultarJwt(string Jwt)
        {
            bool jwt = false;

            try
            {
                table_jwt jwtResult = null;
                using (WantgoProdEntities ctx = new WantgoProdEntities())
                {
                    var request = from item in ctx.table_jwt
                                  where item.jwt == Jwt
                                  select item;

                    jwtResult = request.FirstOrDefault <table_jwt>();

                    if (jwtResult != null)
                    {
                        return(jwt = true);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex.InnerException;
            }
            return(jwt);
        }
Exemplo n.º 2
0
        public long CreateJwt(table_jwt jwt)
        {
            int result = -1;

            try
            {
                var       ctx   = new WantgoProdEntities();
                table_jwt token = new table_jwt()
                {
                    jwt = jwt.jwt
                };
                ctx.table_jwt.Add(token);
                result = ctx.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex.InnerException;
            }

            return(result);
        }