public bool AddSubcode(string name) { if (Subcodes.FirstOrDefault(sc => sc.Name == name) != null) { return(false); } Subcodes.Add(new Subcode(name)); return(true); }
public void AddSubcode(Subcode subcode) { if (Subcodes.FirstOrDefault(sc => sc.Name == subcode.Name) == null) { Subcodes.Add(subcode); } if (!SubcodesIds.Contains(subcode.Name)) { SubcodesIds.Add(subcode.Name); } }
public bool RemoveSubcode(string name) { var toRemove = Subcodes.FirstOrDefault(sc => sc.Name == name); if (toRemove == null) { return(false); } Subcodes.Remove(toRemove); //delete the subcode from all events foreach (var session in Sessions) { foreach (var ev in session.Events) { ev.RemoveSubcode(toRemove); } } return(true); }
public Subcode GetSubcode(string name) { return(Subcodes.FirstOrDefault(s => s.Name == name)); }