public bool DeleteByUserId(int userId) { var tokenRepo = new TokenRepository(); tokenRepo.Delete(tokenRepo.GetAll().Where(x => x.UserId == userId).Select(x => x.TokenId)); tokenRepo.Save(); var isNotDeleted = tokenRepo.GetAll().Select(x => x.UserId == userId).Any(); return(!isNotDeleted); }
public bool Kill(string tokenId) { var tokenRepo = new TokenRepository(); var t = tokenRepo.GetAll().Where(x => x.AuthToken == tokenId).Select(s => s.TokenId); tokenRepo.Delete(t); tokenRepo.Save(); var isNotDeleted = tokenRepo.GetAll().Select(x => x.AuthToken == tokenId).Any(); if (isNotDeleted) { return(false); } return(true); }