public async Task <bool> AddRefreshToken(AuthRefreshToken token) { //Nao pode duplicar foreach (var existingToken in _db.AuthRefreshToken.Where(r => r.Subject == token.Subject && r.ClientId == token.ClientId)) { _db.AuthRefreshToken.Remove(existingToken); } _db.SaveChanges(); _db.AuthRefreshToken.Add(token); return(await _db.SaveChangesAsync() > 0); }
public async Task <bool> RemoveRefreshToken(AuthRefreshToken refreshToken) { _db.AuthRefreshToken.Remove(refreshToken); return(await _db.SaveChangesAsync() > 0); }