private static int SerialContractnumber = 1000000; // serial number that change for each contract public void AddNanny(Nanny n) { if (DS.DataSource.Nannys.Exists(na => na.ID == n.ID))//check if the nanny is allready exists { throw new Exception("nanny allready exists"); } DS.DataSource.Nannys.Add(n.NannyDeepClone()); }
public void AddNanny(Nanny Newnanny) { if (ExistNanny(Newnanny)) { throw new Exception("ERROR nunny is allready exist!! Please check your ID."); } DataSource.Nannys.Add(Newnanny.NannyDeepClone()); }
public void addNanny(Nanny n) { int index = DataSource.Nannies.FindIndex(t => t.ID == n.ID); if (index != -1) { throw new Exception("You are trying to add already-existing nanny"); } DataSource.Nannies.Add(n.NannyDeepClone()); }
public void AddNanny(Nanny nanny) { if (!DS.DataSource.List_of_Nannies.Any(item => item.ID == nanny.ID)) { DS.DataSource.List_of_Nannies.Add(nanny.NannyDeepClone());//keep order according to mothers? } else { throw new Exception("ERROR!: Nanny already exists\n"); } }