Пример #1
0
 public void Create(MailModel toUpdate)
 {
     foreach (MailModel model in mailList)
     {
         if (model.Id == toUpdate.Id)
         {
             throw new System.InvalidOperationException("Duplicate id: " + model.Id);
         }
     }
     mailList.Add(toUpdate);
 }
Пример #2
0
 public void Update(MailModel toUpdate)
 {
     foreach (MailModel model in mailList)
     {
         if (model.Id == toUpdate.Id)
         {
             mailList.Remove(model);
             mailList.Add(toUpdate);
             break;
         }
     }
 }