Example #1
0
        public ActionResult Register(RegisterModel model)
        {
            // Attempt to register the user
            MembershipCreateStatus createStatus;
            CreateUser(model.Email,model.Password,model.Name,model.NationalityId,model.LanguageId,out createStatus);

            if ( createStatus == MembershipCreateStatus.Success)
            {
                FormsAuthentication.SetAuthCookie(model.Email, false /* createPersistentCookie */);
                return RedirectToAction("Index", "Home");
            }
            else
            {
                ModelState.AddModelError("", ErrorCodeToString(createStatus));
                return RedirectToAction("Register", "Account");
            }

            //if (ModelState.IsValid)
            //{
            //    // Attempt to register the user
            //    MembershipCreateStatus createStatus;
            //    Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null, out createStatus);

            //    if (createStatus == MembershipCreateStatus.Success)
            //    {
            //        FormsAuthentication.SetAuthCookie(model.UserName, false /* createPersistentCookie */);
            //        return RedirectToAction("Index", "Home");
            //    }
            //    else
            //    {
            //        ModelState.AddModelError("", ErrorCodeToString(createStatus));
            //    }
            //}

            // If we got this far, something failed, redisplay form
            return View(model);
        }
Example #2
0
        // GET: /Account/Register
        public ActionResult Register()
        {
            RegisterModel model;

            using (SGFEntitiess reg = new SGFEntitiess())
            {
                var c = from i in reg.SGF_R_COUNTRY
                                    orderby i.COUNTRY_NAME
                                    select i;
                var l = from i in reg.SGF_R_LANGUAGE
                            orderby i.LANGUAGE
                            select i;
                model = new RegisterModel
                {
                    Countries = c.ToList().AsEnumerable(),
                    Languages = l.ToList().AsEnumerable()
                };
            }

            return View(model);
        }