public Postcard Add(Postcard item) { if (item == null) { throw new ArgumentNullException("item"); } item.Id = _nextId++; postcards.Add(item); return item; }
public bool Update(Postcard item) { if (item == null) { throw new ArgumentNullException("item"); } int index = postcards.FindIndex(p => p.Id == item.Id); if (index == -1) { return false; } postcards.RemoveAt(index); postcards.Add(item); return true; }