コード例 #1
0
        public ActionResult UserRegistration(RRSBOL.Users user)
        {
            bool   Status  = false;
            string message = "";

            //Model validation
            if (ModelState.IsValid)
            {
                //Verify the Email
                #region
                var isExist = isEmailExist(user.Email);
                if (isExist)
                {
                    ModelState.AddModelError("EmailExist", "Email ALready Exist");
                    return(View("UserRegistration"));
                }
                #endregion

                //Generate Activation Code
                #region
                user.ActivationCode = Guid.NewGuid();
                #endregion

                //Password hashing
                #region
                user.Password        = Crypto.Hash(user.Password);
                user.ConfirmPassword = Crypto.Hash(user.ConfirmPassword);
                #endregion

                //Saving data to the database
                UsersBLL userBLL = new UsersBLL();
                bool     result  = userBLL.UserRegistration(user);
                if (result)
                {
                    @ViewBag.message = "User registred successfully";
                    user.Email       = string.Empty;
                    return(View());
                }
            }
            else
            {
                @ViewBag.message = "Invalid Argument";
            }
            return(View());
        }
コード例 #2
0
 public void AddUsers(RRSBOL.Users user)
 {
     UsersBLL usersBLL = new UsersBLL();
     bool     result   = usersBLL.UserRegistration(user);
 }