示例#1
0
        public async Task<ActionResult> AddUser(AddEmployeeUserViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser { UserName = model.Login, Email = model.email };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);
                    model.AddEmployee(user.Id);
                    return RedirectToAction("Index", "Employee");
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
示例#2
0
 public ActionResult AddUser()
 {
     AddEmployeeUserViewModel model = new AddEmployeeUserViewModel();
     return View(model);
 }