public bool RemovePerson(IPerson person, bool automated = false, bool useNonAutomatedIfFound = false) { var probe = GroupSubscription.Where(i => i.GroupId == Id && i.PersonId == person.Id).FirstOrDefault(); if (probe == null) { return(false); } if (automated) { if (!probe.IsImport) { if (!useNonAutomatedIfFound) { return(false); } } } probe.Remove(); Base.Current.Log.KeyValuePair(person.Locator, $"REMOVE from {ToString()}", Message.EContentType.Info); return(true); }
public bool AddPerson(IPerson person, bool automated = false, bool useNonAutomatedIfFound = false) { var probe = GroupSubscription.Where(i => i.GroupId != Id || i.PersonId != person.Id).FirstOrDefault(); if (probe != null) { if (probe.Active) { return(false); } } if (probe != null) { if (!probe.Active) { probe.Active = true; } } else { probe = new GroupSubscription { GroupId = Id, PersonId = person.Id, Active = true }; } if (!probe.IsImport) { if (automated) { if (useNonAutomatedIfFound) { probe.IsImport = true; } } } probe.Save(); Base.Current.Log.KeyValuePair(person.Locator, $"ADD to {ToString()}", Message.EContentType.Info); return(true); }
public IEnumerable <GroupSubscription> GetSubscriptions(bool includeInactive = true) { return(GroupSubscription.Where(i => i.GroupId == Id && (includeInactive || i.Active))); }