public ActionResult ResendEmail(LoginViewModel model)
        {
            UserMaster user = UserMaster.GetUserByEmail(model.Email, con);

            if (user == null)
            {
                ModelState.AddModelError("", "Invalid login attempt.");
                return(View(model));
            }

            CommonStuff.SendEmail(model.Email, "Welcome to DotNetIsEasy.com", CommonStuff.getEmailVerificationBody(user.email, user.emailvalidationToken));
            return(RedirectToAction("Login", "Account"));
            //return View();
        }
        public ActionResult CreateUser(CreateUserViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            if (model.Password != model.ConfirmPassword)
            {
                ModelState.AddModelError("", "password and Confirm password doesnot match");
                return(View(model));
            }

            UserMaster user = UserMaster.GetUserByEmail(model.EmailAddress, con);

            if (user != null)
            {
                ModelState.AddModelError("", "Email already Registered");
                return(View(model));
            }

            string strp = UserMaster.EncryptString(model.Password);

            UserMaster new_user = new UserMaster();

            new_user.cid             = Convert.ToInt32(Session["cid"]);
            new_user.email           = model.EmailAddress;
            new_user.display_name    = model.DisplayName;
            new_user.hashed_password = strp;
            new_user.mobile_number   = model.Mobile;
            new_user.created_by_uid  = Convert.ToInt32(Session["uid"]);

            int i = UserMaster.CreateUser(new_user, con);

            if (i > 0)
            {
                user = UserMaster.GetUserByEmail(model.EmailAddress, con);
                CommonStuff.SendEmail(user.email, "Welcome to DotNetIsEasy.com", CommonStuff.getEmailVerificationBody(user.email, user.emailvalidationToken));

                //user = UserMaster.Login(model.EmailAddress, model.Password, con);

                //Session["uid"] = user.uid;
                //Session["DisplayName"] = user.display_name;
                //Session["cid"] = user.cid;
                return(RedirectToAction("Success", "Account"));
            }
            else
            {
                return(View(model));
            }
        }