Beispiel #1
0
        public void Insert(UsersEntity entity)
        {
            //logic goes here

            UsersDao UserDao = new UsersDao();
            UserDao.Insert(entity);
        }
Beispiel #2
0
        /// <summary>
        /// 创建用户
        /// </summary>
        /// <param name="us"></param>
        /// <returns></returns>
        public bool CreateUser(Users us)
        {
            UsersDao ud = new UsersDao();
            if (ud.Insert(us) > 0)
                return true;

            return false;
        }
        public ActionResult Create(User user)
        {
            if (ModelState.IsValid)
            {
                var dao = new UsersDao();

                var encrytedMD5Pass = Encryptor.MD5Hash(user.Password);
                user.Password = encrytedMD5Pass;
                var id = dao.Insert(user);
                if (id > 0)
                {
                    SetAlert("Add users success!", "success");
                    return(RedirectToAction("Index", "Users"));
                }
                else
                {
                    ModelState.AddModelError("", "Additional user!");
                }
            }
            return(View("Index"));
        }