예제 #1
0
        public ActionResult CreateRabbitUser(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                MembershipCreateStatus createStatus;
                Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null, out createStatus);

                if (createStatus == MembershipCreateStatus.Success)
                {
                    //TODO: przy większej ilości strategi mozna dodac comboboxa w widoku do wyboru strategi i przekazywac nazwe strategi tutaj
                    var strategyName = "Randomer";

                    this._betStrategyService.BindUserWithStrategy(model.UserName, strategyName);
                    this._betStrategyService.ApplyStrategyForUserToExistedGames(model.UserName, strategyName);
                    this._rankingService.SetupUserRanking(model.UserName);
                    return RedirectToAction("Index");
                }
                else
                {
                    ModelState.AddModelError("", ErrorCodeToString(createStatus));
                }
            }

            return View(model);
        }
예제 #2
0
        public ActionResult CreateUser(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                MembershipCreateStatus createStatus;
                Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null, out createStatus);

                if (createStatus == MembershipCreateStatus.Success)
                {
                    this._rankingService.SetupUserRanking(model.UserName);
                    this.TryAddUserToRole(model.UserName,model.Role);
                    return RedirectToAction("Index");
                }
                else
                {
                    ModelState.AddModelError("", ErrorCodeToString(createStatus));
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }