public ActionResult Add_detpart(staffInfo p) { Dictionary <string, object> dic = new Dictionary <string, object>(); db.staffInfo.Add(p); int num = db.SaveChanges(); dic.Add("res", num > 0 ? true : false); return(Json(dic)); }
//删除 public ActionResult Del(int empId) { Dictionary <string, bool> dic = new Dictionary <string, bool>(); staffInfo id = db.staffInfo.Find(empId); staffInfo ids = db.staffInfo.Remove(id); db.SaveChanges(); dic.Add("res", ids != null); return(Json(dic)); }
public ActionResult UpdetSalary(staffInfo p) { Dictionary <string, bool> dic = new Dictionary <string, bool>(); var info = db.staffInfo.Find(p.empId); info.empBonus = p.empBonus; info.empSalary = p.empSalary; int num = db.SaveChanges(); dic.Add("res", num > 0 ? false : true); return(Json(dic)); }
//保存修改 public ActionResult Updet(staffInfo p) { Dictionary <string, bool> dic = new Dictionary <string, bool>(); var info = db.staffInfo.Find(p.empId); info.empPosition = p.empPosition; info.empHrId = p.empHrId; info.empInDate = p.empInDate; info.empSalary = p.empSalary; info.deptId = p.deptId; int num = db.SaveChanges(); dic.Add("res", num <= 0); return(Json(dic)); }