public JsonResult TKEditPass(string id, string id1) { LoginsController logins = new LoginsController(); if (id.Length <= 5) { string output = "Mật khẩu phải dài hơn 6 ký tự !"; return(Json(output, JsonRequestBehavior.AllowGet)); } else if (id1.Length <= 0) { string output = "Không được để trống mật khẩu xác nhận !"; return(Json(output, JsonRequestBehavior.AllowGet)); } else if (id != id1) { string output = "Mật khẩu không khớp nhau !"; return(Json(output, JsonRequestBehavior.AllowGet)); } else { string kh_id = Session["KH_ID"].ToString(); KHACHHANG kHACHHANG = db.KHACHHANGs.Find(kh_id); if (kHACHHANG != null) { kHACHHANG.KH_MATKHAU = logins.Encrypt(id); db.SaveChanges(); } string output = "Mật khẩu đã được thay đổi !"; return(Json(output, JsonRequestBehavior.AllowGet)); } }
public ActionResult EditKH([Bind(Include = "KH_ID,KH_TEN,KH_EMAIL,KH_SDT,KH_DIACHI,KH_NGAYSINH,KH_GIOITINH,KH_TAIKHOAN,KH_MATKHAU,KH_TRANGTHAI")] KHACHHANG kHACHHANG) { LoginsController logins = new LoginsController(); if (ModelState.IsValid) { db.Entry(kHACHHANG).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("IndexKH")); } return(View(kHACHHANG)); }
public ActionResult Edit([Bind(Include = "KH_ID,KH_TEN,KH_EMAIL,KH_SDT,KH_DIACHI,KH_NGAYSINH,KH_GIOITINH,KH_TAIKHOAN,KH_MATKHAU,KH_TRANGTHAI")] KHACHHANG kHACHHANG) { string mk = Request["KH_MATKHAU"].ToString(); LoginsController logins = new LoginsController(); if (ModelState.IsValid) { if (Session["KH_ID"].ToString() != mk) { kHACHHANG.KH_MATKHAU = logins.Encrypt(mk); } db.Entry(kHACHHANG).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(kHACHHANG)); }
public ActionResult Edit([Bind(Include = "NV_ID,LNV_ID,NV_TEN,NV_NGAYSINH,NV_QUEQUAN,NV_DIACHI,NV_GIOITINH,NV_NGAYKYHOPDONG,NV_NGAYKETTHUCHOPDONG,NV_EMAIL,NV_MATKHAU,NV_TAIKHOAN,NV_SDT")] NHANVIEN nHANVIEN) { string MK = Request["NV_MATKHAU"].ToString(); LoginsController logins = new LoginsController(); if (ModelState.IsValid) { if (Session["NV_MK"].ToString() != MK) { nHANVIEN.NV_MATKHAU = logins.Encrypt(MK); } db.Entry(nHANVIEN).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.LNV_ID = new SelectList(db.LOAINVs, "LNV_ID", "LNV_TEN", nHANVIEN.LNV_ID); return(View(nHANVIEN)); }