public IActionResult OnPostPickWinnerAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            string currentWinners = HttpContext.Session.GetString("currentWinners");

            int winnerId = WinnerManager.PickNextWinner <RSVP>(currentWinners, RSVPs);

            if (winnerId == -1)
            {
                Winner.Name = "No more atteendees left!!!";
            }
            else
            {
                Winner.Name       = RSVPs[winnerId].Name;
                Winner.PictureUri = RSVPs[winnerId].PictureUri;
                currentWinners    = currentWinners + winnerId.ToString() + ",";
                HttpContext.Session.SetString("currentWinners", currentWinners);
            }

            return(Page());
        }
Beispiel #2
0
 private void Awake()
 {
     sharedInstance = this;
 }