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); }
public void Update(MailModel toUpdate) { foreach (MailModel model in mailList) { if (model.Id == toUpdate.Id) { mailList.Remove(model); mailList.Add(toUpdate); break; } } }