public int CountWords(WordCount wc) { int count; var wordList = new List<string>(); wordList = wc.Input.Split().ToList(); count = wordList.Count(); return count; }
public ActionResult WordCounter(WordCountTool model) { if (ModelState.IsValid) { var wc = new WordCount(); wc.Input = model.UserInput; var we = new WordEnumerator(); model.Count = we.CountWords(wc); return View(model); } return View("WordCounter", model); }