public IActionResult PasswordGenerator()
        {
            var model = new PasswordGenerateDTO();

            model.Length      = 8;
            model.PasswordCnt = 1;
            model.Number      = true;
            model.Lower       = true;
            model.Passwords   = new List <string>();
            return(View(model));
        }
        public IActionResult PasswordGenerator(PasswordGenerateDTO model)
        {
            model.Passwords = new List <string>();

            if (model.Number == false & model.Lower == false && model.Upper == false)
            {
                ModelState.AddModelError("Condition", "กรุณาระบุเงือนไข");
            }

            if (ModelState.IsValid)
            {
                for (var i = 0; i < model.PasswordCnt; i++)
                {
                    var password = RandomPassword(model.Length, model.Number, model.Lower, model.Upper);
                    model.Passwords.Add(password);
                }
            }
            return(View(model));
        }