Beispiel #1
0
        public static string GetRefreshToken(TiendaOnlineContext _db, string email)
        {
            EmailConRefreshToken emailConToken = _db.EmailsConRefreshTokens.Where(e => e.Email == email.ToUpper()).FirstOrDefault();

            if (emailConToken != null)
            {
                return(emailConToken.RefreshToken);
            }

            return("");
        }
Beispiel #2
0
        public static void CrearEmailConRefresh(TiendaOnlineContext _db, string email, string accessToken, string refreshToken)
        {
            EmailConRefreshToken existe = _db.EmailsConRefreshTokens.Where(e => e.Email == email.ToUpper()).FirstOrDefault();

            if (existe != null)
            {
                existe.AccessToken  = accessToken;
                existe.RefreshToken = refreshToken;
            }
            else
            {
                EmailConRefreshToken nuevo = new EmailConRefreshToken();
                nuevo.Email        = email.ToUpper();
                nuevo.AccessToken  = accessToken;
                nuevo.RefreshToken = refreshToken;
                //_db.EmailsConRefreshTokens.Add(nuevo);
            }
            _db.SaveChanges();
        }