public ActionResult ViewHieuChinhPhongBan(int?id) { PhongBanService _phongban = new PhongBanService(); PhongBan phongban = new PhongBan(); if (id.HasValue && id.Value != 0) { phongban = _phongban.FindByKey(id.Value); } return(PartialView("_HieuChinhPhongBan", phongban)); }
public JsonResult ThayDoiTrangThai(int?id) { if (id.HasValue) { PhongBanService _phongban = new PhongBanService(); var phongban = _phongban.FindByKey(id.Value); if (phongban != null) { phongban.ConHoatDong = phongban.ConHoatDong.HasValue ? !phongban.ConHoatDong : true; _phongban.Update(phongban); return(Json(new { status = true }, JsonRequestBehavior.AllowGet)); } } return(Json(new { status = false, message = "Phòng ban không khả dụng" })); }