コード例 #1
0
        public async Task <IActionResult> Create([Bind("SecretaryId,CNP,FirstName,LastName,MailAddress,Password,Address,Birthday")] Secretary secretary)
        {
            var user = new IdentityUser {
                UserName = secretary.MailAddress, Email = secretary.MailAddress
            };
            var result = await userManager.CreateAsync(user, secretary.Password);

            if (ModelState.IsValid)
            {
                await userManager.AddToRoleAsync(user, "Secretary");

                secretaryService.Create(secretary);
                return(RedirectToAction(nameof(Index)));
            }
            return(View(secretary));
        }
コード例 #2
0
 public Secretary Create(Secretary secretary) => service.Create(secretary);