public void AddTrackback(Trackback item, TrackbackStatus status) { switch (status) { case TrackbackStatus.Pending: { this.Pending.Add(item); break; } case TrackbackStatus.IsSpam: { this.Spam.Add(item); break; } case TrackbackStatus.IsApproved: { this.Approved.Add(item); break; } default: { throw new ArgumentException("Unable to add a trackback for the specified status", "status"); } } }
public void Delete(int trackbackId, TrackbackStatus status) { Trackback itemToRemove; switch (status) { case TrackbackStatus.Pending: { itemToRemove = this.Pending.SingleOrDefault(x => x.Id == trackbackId); this.Pending.Remove(itemToRemove); break; } case TrackbackStatus.IsSpam: { itemToRemove = this.Spam.SingleOrDefault(x => x.Id == trackbackId); this.Spam.Remove(itemToRemove); break; } case TrackbackStatus.IsApproved: { itemToRemove = this.Approved.SingleOrDefault(x => x.Id == trackbackId); this.Approved.Remove(itemToRemove); break; } default: { throw new ArgumentException("Unable to find a trackback with the specified id", "trackbackId"); } } }