public async Task <List <Donation> > SearchDonations(DonationQuery query)
 {
     using (var connection = GetConnection())
     {
         return((await connection.QueryAsync <Donation>(
                     @"SELECT * FROM donation
             WHERE donee like @TextSearch OR party like @TextSearch or donee_address like @TextSearch",
                     query
                     )).ToList());
     }
 }
 public async Task <List <PartyDonations> > GetDonationsByParty(DonationQuery query)
 {
     using (var connection = GetConnection())
     {
         return((await connection.QueryAsync <PartyDonations>(
                     @"SELECT party, SUM(amount) as total, SUM(number_of_donations) as numberOfDonations,
                      SUM(amount) / SUM(number_of_donations) as average
               FROM donation
               WHERE number_of_donations > 0
               AND   (@Year IS NULL OR year = @Year)
               GROUP BY party", query
                     )).ToList());
     }
 }