/// <summary> /// Gets the percentage of entrants. /// </summary> /// <param name="answer"> /// The possible answer. /// </param> /// <returns> /// The percentage of entrants for a given answer. /// </returns> public decimal GetPercentageOfEntrants(CompetitionAnswer answer) { if (ValidEntrants.Any()) { return((decimal)ValidEntrants.Count(e => e.Answer == answer) / ValidEntrants.Count() * 100); } return(0); }
/// <summary> /// Gets the number of entrants. /// </summary> /// <param name="answer"> /// The answer. /// </param> /// <returns> /// The number of entrants for a given answer. /// </returns> public int GetNumberOfEntrants(CompetitionAnswer answer) { return(ValidEntrants.Any() ? ValidEntrants.Count(e => e.Answer == answer) : 0); }