public ActionResult Index(NameGeneratorViewModel nameGeneratorViewModel) { if (!string.IsNullOrEmpty(nameGeneratorViewModel.InputText)) { string[] inputWords = nameGeneratorViewModel.InputText.Split(' '); } if (Request.Form["girl-button"] != null) { nameGeneratorViewModel.Name = Util.UppercaseFirst(NameRepository.AllFirstNames[(new Random().Next(NameRepository.FemaleFirstNames.Length))].Trim()); } if (Request.Form["boy-button"] != null) { nameGeneratorViewModel.Name = Util.UppercaseFirst(NameRepository.AllFirstNames[(new Random().Next(NameRepository.MaleFirstNames.Length))].Trim()); } return(View(nameGeneratorViewModel)); }
public NameGeneratorView() { InitializeComponent(); DataContext = new NameGeneratorViewModel(); }