partial         void HandleImplementation(CreateAccount message)
        {
            // Implement your handler logic here.
            Console.WriteLine("AccountManagement received " + message.GetType().Name);
        }
示例#2
0
        public ActionResult Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                // Attempt to register the user
                try
                {
                    //WebSecurity.CreateUserAndAccount(model.UserName, model.Password);
                    //WebSecurity.Login(model.UserName, model.Password);

                    var createAccountMessage = new CreateAccount { AccountId = Guid.NewGuid(), Email = model.UserName };

                    MvcApplication.Bus.Send(createAccountMessage);

                    return RedirectToAction("Index", "Home");
                }
                catch (MembershipCreateUserException e)
                {
                    ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }
示例#3
0
 public void Send(CreateAccount message)
 {
     Bus.Send(message);
 }