Exemplo n.º 1
0
        public ActionResult CreateTrader(Register user, bool gender)
        {
            if (ModelState.IsValid)
            {
                var dao = new RegisterDao();

                var encryptorMD5Pass = Encryptor.MD5Hash(user.UserAu.Password_User);
                user.UserAu.Password_User = encryptorMD5Pass;
                user.UserAu.Id_UserKind   = 2;
                user.UserAu.Penalty       = 3;
                long id = dao.InsertTrader(user, gender);
                if (id > 0)
                {
                    Session["FarmerId"] = id;
                    return(RedirectToAction("Index", "Trader"));
                }

                else
                {
                    ModelState.AddModelError("", Common.ErrorList.REGISTER_ERROR);
                }
            }
            else
            {
                ModelState.AddModelError("", Common.ErrorList.Wrong_Validation);
            }
            return(View("CreateRegister"));
        }
Exemplo n.º 2
0
        public ActionResult CreateFarmer(Register user)
        {
            if (ModelState.IsValid)
            {
                var dao = new RegisterDao();

                var encryptorMD5Pass = Encryptor.MD5Hash(user.UserAu.Password_User);
                user.UserAu.Password_User = encryptorMD5Pass;

                long id = dao.InsertTrader(user);
                if (id > 0)
                {
                    return(RedirectToAction("Index", "User"));
                }
                else
                {
                    ModelState.AddModelError("", Common.ErrorList.REGISTER_ERROR);
                }
            }
            return(View("Create"));
        }