private bool ContainsNotSyncedData() { using (var cached = _cachedProfiles.ProfileData()) { return(cached.Sync.Any()); } }
public Profile WithUniqueName(Profile profile) { if (profile == null) { return(null); } using (var cached = _cachedProfiles.ProfileData()) { var local = cached.Local.Where(x => x.Status != ProfileStatus.Deleted).ToList(); var sync = cached.Local.Where(x => x.Status != ProfileStatus.Deleted).ToList(); var p = profile.WithUniqueNameCandidate(_appConfig.MaxProfileNameLength); while (ContainsOtherWithSameName(local, p) || ContainsOtherWithSameName(sync, p) || ContainsOtherWithSameName(cached.External, p)) { p = p.WithNextUniqueNameCandidate(_appConfig.MaxProfileNameLength); } return(p); } }
public Task <IReadOnlyList <Profile> > GetAll() { var predefinedProfiles = _predefinedProfiles.GetAll(); using (var cached = _cachedProfiles.ProfileData()) { var cachedProfiles = cached.Local .Union(cached.Sync, ProfileIdEqualityComparer) .Union(cached.External, ProfileIdEqualityComparer) .Where(p => p.Status != ProfileStatus.Deleted); IReadOnlyList <Profile> profiles = predefinedProfiles .Concat(cachedProfiles) .ToList(); return(Task.FromResult(profiles)); } }