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 FiveByFiveLetterModel(GridLettersSearchResultsEntity entity) { CharacterList = entity.CharacterList; WordsFound = entity.WordsFound; NoMatchFound = entity.NoMatchFound; }