Ejemplo n.º 1
0
        public ActionResult Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                if (model.Register(model) > 0)
                {
                    FormsAuthentication.SetAuthCookie(model.UserName, false);
                    return(RedirectToAction("Index", "Home"));
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Ejemplo n.º 2
0
        public virtual ActionResult Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                Status status;
                if(model.Register(out status))
                    return this.RedirectToAction<HomeController>(a => a.Index());
                
                ModelState.AddModelError("Error", status.Message());
            }
            else
            {
                ModelState.AddModelError("Error", "Please update the required fields");
            }

            // Initialize the meta data information
            model = BaseModelHelper.GetRegisterModel(model);
            return View(model);
        }
Ejemplo n.º 3
0
        public virtual ActionResult Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                Status status;
                if (model.Register(out status))
                {
                    return(this.RedirectToAction <HomeController>(a => a.Index()));
                }

                ModelState.AddModelError("Error", status.Message());
            }
            else
            {
                ModelState.AddModelError("Error", "Please update the required fields");
            }

            // Initialize the meta data information
            model = BaseModelHelper.GetRegisterModel(model);
            return(View(model));
        }