public ActionResult Register(usder acc) { if (ModelState.IsValid) { acc.MatKhau = encry.PasswordEncryption(acc.MatKhau); db.usders.Add(acc); db.SaveChanges(); return(RedirectToAction("Login", "TaiKhoans")); } return(View(acc)); }
public ActionResult Login(usder acc) { if (ModelState.IsValid) { string encryptionpass = encry.PasswordEncryption(acc.MatKhau); var model = db.TaiKhoans.Where(m => m.TenDangNhap == acc.TenDangNhap && m.MatKhau == encryptionpass).ToList().Count(); if (model == 1) { FormsAuthentication.SetAuthCookie(acc.TenDangNhap, true); return(View("Index", "ThongTinKhachHangs")); } else { ModelState.AddModelError(" ", "Thông Tin Đăng Nhập Không Chính Xác"); } } return(View(acc)); }