public async Task <IActionResult> Create([Bind("Id,Name,Age,SecondName")] Student student)
        {
            if (ModelState.IsValid)
            {
                _context.Add(student);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(student));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("Id,Email,Password")] Account account)
        {
            if (ModelState.IsValid)
            {
                account.EncryptPassword();
                account.GenerateSalt();
                _context.Add(account);
                await _context.SaveChangesAsync();

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