예제 #1
0
        public async Task <IActionResult> Create([Bind("Id,Email,Password,ConfirmPassword,UserInformation")] Account account)
        {
            if (ModelState.IsValid)
            {
                account.Salt     = SecurityHelper.PasswordHandle.GetInstance().GenerateSalt();
                account.Password = SecurityHelper.PasswordHandle.GetInstance()
                                   .EncryptPassword(account.Password, account.Salt);
                _context.Add(account);
                _context.Add(account.UserInformation);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(account));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Logo,RedirectUrl,Description")] RegisterApplication registerApplication)
        {
            if (ModelState.IsValid)
            {
                _context.Add(registerApplication);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(registerApplication));
        }