public void GiveTicketsToUsersWhoNeverHasWonInThisCategory(List<UserTickets> userRaffleTicketsList, int number) { var NeverWon = new List<UserTickets>(); foreach (var urt in userRaffleTicketsList) { if (PreviousWinsInCategoryByUser(urt.Email) == 0) { NeverWon.Add(urt); } } if (NeverWon.Count() > 0) { var drawing = new DrawWinners(eventId, context); drawing.ApplyRules = false; drawing.UserTicketsList = NeverWon; drawing.ExecuteDraw(); var winners = context.Winners.Where(x => x.EventId == eventId).ToList(); winners.ForEach(x => userRaffleTicketsList.RemoveAll(y => y.Email == x.UserEmail)); } }
public void PerformDrawing(int eventId) { var drawing = new DrawWinners(eventId, context); drawing.ExecuteDraw(); }