public Trail Add(Trail trail) { if (trail == null) { throw new ArgumentNullException("trail"); } trail.Id = _nextId++; trails.Add(trail); return trail; }
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; }