private void SetBy(Service.ServiceTypes st, ServiceConstraint sc) { var existing = GetBy(st); if (existing == null) { this.ServiceConstraints.Add(sc); } else if (sc == null) { this.ServiceConstraints.Remove(existing); } else { existing = sc; } }
private ServiceConstraint GetBy(Service.ServiceTypes st) { return(this.ServiceConstraints.SingleOrDefault(f => f.ServiceTypeId == (int)st)); }