public void RemoveInterested(Event @event) { if (!Interests.Any(ui => ui.EventId == @event.EventId)) { throw new Exception("Event not in 'Interested'"); } else { UserInterested userInterested = Interests.SingleOrDefault(ui => ui.EventId == @event.EventId); Interests.Remove(userInterested); } }
public IEnumerable <(Tax tax, decimal taxValue)> CalcInterestsTaxes() { if (!Interests.Any()) { return(null); } else { var result = Interests.Sum(x => x.ConvertedBasis); var taxProfile = ReportOptions.Profile.TaxesProfiles[TaxClassCodes.General]; return(taxProfile.ApplyTaxes(result)); } }
public void AddGoing(Event @event) { if (Goings.Any(ug => ug.EventId == @event.EventId)) { throw new Exception("Event already in 'Going'"); } else if (Interests.Any(ui => ui.EventId == @event.EventId)) { UserInterested userInterested = Interests.SingleOrDefault(ui => ui.EventId == @event.EventId); Interests.Remove(userInterested); UserGoing userGoing = new UserGoing(this, @event); Goings.Add(userGoing); } else { UserGoing userGoing = new UserGoing(this, @event); Goings.Add(userGoing); } }