void AddStop(StopData sd) { //Do we know about this in ther DB? var stop = GetStop(sd); Stop si; if (stop != null) { si = new Stop(stop); } else { si = new Stop(sd); } if (stop != null) { stopdatabase.DeleteItem(si); } //Cache and Add stopdatabase.SaveItem(si); if (!Stops.Contains(sd)) { Stops.Add(sd); } else { Stops.Remove(sd); Stops.Add(sd); } }
/// <summary> /// Called by the underlying <see cref="SvgElement"/> when an element has been removed from the /// 'Children' collection. /// </summary> /// <param name="child">The <see cref="SvgElement"/> that has been removed.</param> protected override void RemoveElement(SvgElement child) { if (child is SvgGradientStop) { Stops.Remove((SvgGradientStop)child); } base.RemoveElement(child); }
public void RemoveParticipantFromRide(AppUserId participantId) { var stop = Stops.SingleOrDefault(x => x.ParticipantId == participantId); if (stop == default) { throw new Exception("User does not exists in this ride"); } Stops.Remove(stop); }