public ActionResult Create(T_ZC_User t_zc_user) { if (Request.IsAjaxRequest()) { if (ModelState.IsValid) { t_zc_user.CreatedAt = DateTime.Now; t_zc_user.UpdatedAt = DateTime.Now; t_zc_user.UseLevel = (int)UseLevel.System; t_zc_user.IsValid = true; db.T_ZC_User.Add(t_zc_user); int result = db.SaveChanges(); if (result > 0) return ReturnJson(true, "操作成功", "", "userInfoBox", true, ""); else return ReturnJson(false, "操作失败", "", "", false, ""); } } ViewBag.DepartmentID = new SelectList(db.T_ZC_Department, "ID", "Name", t_zc_user.DepartmentID); return Json(new { }); }
public ActionResult PersonalSet(T_ZC_User t_zc_user) { if (Request.IsAjaxRequest()) { if (ModelState.IsValid) { t_zc_user.UpdatedAt = DateTime.Now; t_zc_user.UseLevel = (int)UseLevel.System; t_zc_user.IsValid = true; db.Entry(t_zc_user).State = EntityState.Modified; int result = db.SaveChanges(); if (result >= 0) return ReturnJson(true, "个人信息设置成功", "", "userInfoBox", true, ""); else return ReturnJson(false, "个人信息设置失败", "", "", false, ""); } } return Json(new { }); }