public ActionResult Create([Bind(Include = "RoleID,RoleName")] Roles roles) { if (ModelState.IsValid) { db.Roles.Add(roles); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(roles)); }
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)); }
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)); }