Example #1
0
        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));
        }
Example #2
0
 public NameGeneratorView()
 {
     InitializeComponent();
     DataContext = new NameGeneratorViewModel();
 }