public async Task <IHttpActionResult> Register(LoginViewModel model) { if (ModelState.IsValid) { IBLL.IUserManager userManager = new BLL.UserManager(); if (await userManager.GetUserByEmail(model.Email) == null) { await userManager.Register(model.Email, model.LoginPwd); return(this.SendData("注册成功")); } return(this.ErrorData("邮箱已注册")); } return(this.ErrorData("输入数据不合法")); }
public async Task <ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { IBLL.IUserManager userManager = new BLL.UserManager(); if (await userManager.GetUserByEmail(model.Email) == null) { await userManager.Register(model.Email, model.Password); return(RedirectToAction("Index", "Home")); } ModelState.AddModelError("", "邮箱已存在"); } return(View(model)); }