public void addNanny(Nanny nanny) { if (DataSource.nannyList.Exists(nl => nl.nannyId == nanny.nannyId)) { throw new Exception("Nanny is already exist in system"); } DataSource.nannyList.Add(nanny.duplicate()); }
public void updateNanny(Nanny nanny) { int nanindex = DataSource.nannyList.FindIndex(nl => nl.nannyId == nanny.nannyId); if (nanindex == -1) { throw new Exception("Nanny is not exist in system"); } DataSource.nannyList[nanindex] = nanny.duplicate(); }