示例#1
0
 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());
 }
示例#2
0
        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();
        }