public ActionResult SavePermission() { int UserId = int.Parse(Request["UserId"]); var result = new { err = false, message = "no err" }; UserBusinessLayer ubl = new UserBusinessLayer(); UserProfile user = ubl.GetUser(UserId); if (user == null || user.isDeleteUser) { return(HttpNotFound()); } user.isSearchPM = bool.Parse(Request["isSearchPM"]); user.isUploadPM = bool.Parse(Request["isUploadPM"]); user.isModifyPM = bool.Parse(Request["isModifyPM"]); user.isDeletePM = bool.Parse(Request["isDeletePM"]); user = ubl.ModifyUser(user); if (user.isDeleteUser) { result = new { err = true, message = "Error occurs, modify failed" }; return(Json(result)); } return(Json(result)); }
public ActionResult Delete(FormCollection fcNotUsed, int id) { UserBusinessLayer ubl = new UserBusinessLayer(); UserProfile user = ubl.GetUser(id); if (user == null || user.isDeleteUser) { return(HttpNotFound()); } user.isDeleteUser = true; ubl.ModifyUser(user); if (!user.isDeleteUser) { return(Content("Error occurs")); } return(RedirectToAction("UserIndex")); }