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

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