public ActionResult ChangePassword(DangNhap model, FormCollection collection) { var matKhauCu = collection["MatKhauCu"]; var matKhauMoi = collection["MatKhauMoi"]; var nhaplaiMK = collection["NhapLaiMK"]; var encryptedMd5Pas = Encryptor.MD5Hash(matKhauCu); var newPass = Encryptor.MD5Hash(matKhauMoi); var dao = new DangNhapDao(); model = dao.ViewDetails(model.MaTaiKhoan); if (model.MatKhau == encryptedMd5Pas) { if (matKhauMoi == nhaplaiMK) { var nhanvien = _context.DangNhaps.Find(model.MaTaiKhoan); nhanvien.MatKhau = newPass; _context.SaveChanges(); return(RedirectToAction("Logout", "Login")); } else { return(RedirectToAction("Index", "Home")); } } else { return(RedirectToAction("Index", "Home")); } }
public ActionResult Update(DangNhap dn) { var dangNhapDao = new DangNhapDao(); var dangNhap = new DangNhap(); var check = dangNhapDao.UpdateAccount(dn); if (check) { return(RedirectToAction("Logout", "Login")); } return(View("Index")); }
// GET: DangNhap public ActionResult Index(UserLogin userLogin) { var model = new DangNhapDao().ViewDetails(userLogin.UserId); return(View(model)); }