public string[] GetWords(BingoSettings settings)
 {
     var words = settings.WordList.TakeRandom(25).ToArray();
     words.Shuffle();
     words[12] = settings.FreeText;
     return words;
 }
        //
        // GET: /Home/
        public ActionResult Index()
        {
            var settings = new BingoSettings();

            settings.Fonts = Fonts.Select(f => new SelectListItem() { Text = f, Value = f });

            return View(settings);
        }
        public string GetWordListPage(BingoSettings settings)
        {
            var words = new StringBuilder();

            foreach (var word in settings.WordList.OrderBy(w => w))
            {
                words.AppendFormat("<li class='word'>{0}</li>", word);
            }

            return string.Format(WordListPage, words.ToString());
        }
 public string GetSingleCardHtml(BingoSettings settings)
 {
     string rows = string.Empty;
     var words = GetWords(settings);
     for (int i = 0; i < 25; i++)
     {
         if (i % 5 == 0) rows += "<tr>";
         rows += "<td>" + words[i] + "</td>";
         if (i % 5 == 4) rows += "</tr>";
     }
     return string.Format(HtmlCard, settings.Title, settings.Subtitle, rows);
 }
        public ActionResult Index(BingoSettings settings)
        {
            settings.WordList = settings.WordListBlob.Split(new[] { '\r', '\n', ',', ';' }, StringSplitOptions.RemoveEmptyEntries).Select(w => w.Trim()).ToArray();

            while (settings.WordList.Length < 25)
            {
                settings.WordList = settings.WordList.Concat(settings.WordList).ToArray();
            }

            var pageCount = settings.CardCount / 4;
            var pages = new StringBuilder();
            for (int i = 0; i < pageCount; i++)
            {
                pages.Append(string.Format(HtmlPage, GetSingleCardHtml(settings), GetSingleCardHtml(settings), GetSingleCardHtml(settings), GetSingleCardHtml(settings)));
            }
            var wordListPage = GetWordListPage(settings);
            return View(new RenderModel { Font = settings.Font, WordListHtml = new HtmlString(wordListPage), CardsHtml = new HtmlString(pages.ToString()) });
        }