public IActionResult UpdateModulesFuncInterFaceState(ModulesParam param) { var resModel = new ResponseModel(ResponseCode.Error, "修改模块功能接口状态失败"); try { ModulesFunctionInterface modulesfuncinterfaceinfo = new ModulesFunctionInterface() { 是否停用 = param.disable }; //执行修改方法 var row = this.Update <ModulesFunctionInterface>(modulesfuncinterfaceinfo).Columns("是否停用").Where("id", param.id).Execute(); if (row > 0) { resModel.msg = "保存成功"; resModel.code = (int)ResponseCode.Success; } } catch (Exception ex) { LogError("修改模块功能接口状态失败", ex); resModel.msg = "修改模块功能接口状态失败"; } return(Json(resModel)); }
public IActionResult AddModulesFuncInterface([FromBody] ModulesFunctionInterface entity) { var resModel = new ResponseModel(ResponseCode.Error, "操作失败"); try { if (entity.模块id == 0 || entity.功能id == 0) { resModel.msg = "请求参数异常"; return(Json(resModel)); } var count = 0;//数据库执行返回结果 if (entity.id == 0) { entity.登记人 = loginUser.id; entity.登记时间 = DateTime.Now; //ID为空为新增 count = this.Add <ModulesFunctionInterface>(entity).Execute(); } else { entity.更新时间 = DateTime.Now; //修改模块 count = this.Update <ModulesFunctionInterface>(entity) .Columns("命名空间名称", "控制器名称", "方法名", "序号", "更新时间") .Where("id", entity.id).Execute(); } //成功 if (count > 0) { resModel.code = (int)ResponseCode.Success; resModel.msg = "执行成功"; } } catch (Exception ex) { LogError("新增或修改接口", ex); resModel.msg = "操作异常"; } return(Json(resModel)); }