Example #1
0
 public Cervejas Add(Cervejas item)
 {
     if (item == null)
     {
         throw new ArgumentNullException("item");
     }
     item.Id = _nextId++;
     cervejas.Add(item);
     return(item);
 }
Example #2
0
        public bool Update(Cervejas item)
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }
            int index = cervejas.FindIndex(p => p.Id == item.Id);

            if (index == 1)
            {
                return(false);
            }
            cervejas.RemoveAt(index);
            cervejas.Add(item);
            return(true);
        }