public ActionResult Create([Bind(Include = "RoleID,RoleName")] Roles roles)
        {
            if (ModelState.IsValid)
            {
                db.Roles.Add(roles);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(roles));
        }
Пример #2
0
        public ActionResult Create([Bind(Include = "UserName,Password,ConfirmPassWord,Email,CreationTime,EmailConfirmed,IsDelete,DeleteTime,RoleID")] Accounts account)
        {
            if (ModelState.IsValid)
            {
                db.Accounts.Add(account);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(account));
        }
Пример #3
0
        public ActionResult Create([Bind(Include = "UserName,Password,ConfirmPassWord,Email,CreationTime,EmailConfirmed,IsDelete,DeleteTime,RoleID")] Accounts accounts)
        {
            accounts.CreationTime   = DateTime.Now;
            accounts.EmailConfirmed = false;
            accounts.IsDelete       = false;
            string strMD5 = strPro.GetMD5(accounts.Password);

            if (accounts.Password == accounts.ConfirmPassWord)
            {
                accounts.Password        = strMD5;
                accounts.ConfirmPassWord = strMD5;
            }

            if (ModelState.IsValid)
            {
                db.Accounts.Add(accounts);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(accounts));
        }