Exemplo n.º 1
0
        public IActionResult NewBotAccount([FromForm] BotAccountModel account)
        {
            if (!ModelState.IsValid)
            {
                return(View(account));
            }

            try
            {
                _botCredentials.StoreAccount(Mapper.Map <BotAccount>(account));
            }
            catch (Exception)
            {
                ModelState.AddModelError("Name", "A bot with this name already exists.");
                return(View(account));
            }

            return(RedirectToAction("Authentication"));
        }