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