public async Task <ActionResult> Register(RegisterModel registerModel) { try { if (!ModelState.IsValid) { return(Json(ReturnError(), JsonRequestBehavior.AllowGet)); } var userLogin = new CreateUserCommand(registerModel.UserName, registerModel.Password); var result = await _userIdentity.Createuser(userLogin); var jsonResut = new { userName = registerModel.UserName, ConfirmCode = result }; await Task.Factory.StartNew(() => { Thread.Sleep(2000); return(Json(jsonResut, JsonRequestBehavior.AllowGet)); }); return(Json(jsonResut, JsonRequestBehavior.AllowGet)); } catch (Exception e) { return(Json(e.Message, JsonRequestBehavior.AllowGet)); } }