コード例 #1
0
 public Trail Add(Trail trail)
 {
     if (trail == null)
     {
         throw new ArgumentNullException("trail");
     }
     trail.Id = _nextId++;
     trails.Add(trail);
     return trail;
 }
コード例 #2
0
 public bool Update(Trail trail)
 {
     if (trail == null)
     {
         throw new ArgumentNullException("trail");
     }
     int index = trails.FindIndex(t => t.Id == trail.Id);
     if (index == -1)
     {
         return false;
     }
     trails.RemoveAt(index);
     trails.Add(trail);
     return true;
 }