public ActionResult SearchWordsFromFile() { var getTempData = (char[, ])TempData["Characters"] ?? GetCharacterArray(); var searchClass = new RecursiveSearch(); var wordsFound = searchClass.ReadFile(_filePath, getTempData, RowDimension, ColumnDimension); var entity = new GridLettersSearchResultsEntity { WordsFound = new List <string>() }; if (wordsFound.Count > 0) { foreach (var word in wordsFound) { var wordFound = word.Key; var position = word.Value; entity.WordsFound.Add($"{wordFound} found position {position}"); } entity.CharacterList = getTempData; } var model = new FiveByFiveLetterModel(entity); if (wordsFound.Count == 0) { model.NoMatchFound = "No Match found"; } return(View("Index", model)); }
public ActionResult Index() { var charArray = GetCharacterArray(); TempData["Characters"] = charArray; var model = new FiveByFiveLetterModel(charArray) { WordsFound = new List <string>() }; return(View(model)); }