Example #1
0
        public ActionResult Register(RegisterModel model)
        {
            if (model.ConfirmPassword != model.Password)
            {
                ModelState.AddModelError("", "");
                return View(model);
            }
            if (ModelState.IsValid)
            {

                int id = userService.CreateUser(model.ToUserEntity(),model.Email);
                if (id>0)
                {
                    authService.CreateAuthorization(model.ToAuthorizationEntity(id));
                    SendEmail(model.Email, id);
                    return RedirectToAction("Confirm", "Account", new { email = model.Email });
                }
                ModelState.AddModelError("", "");

            }
              return View(model);
        }