/// <summary> /// 增加配置信息 /// </summary> /// <param name="param"></param> /// <returns></returns> public async Task <ActionResult> AddInfoConfig(string param) { JsonResponse result = new JsonResponse(); try { InfoConfigEntity entity = JsonConvert.DeserializeObject <InfoConfigEntity>(param); entity.CreationTime = DateTime.Now; var res = await _infoConfigServices.AddInfoConfig(entity); if (res == -1) { result.code = ResponseCode.Fail; result.msg = "配置信息已存在"; return(Json(result)); } await _logServices.WriteSystemLog(LoginUser.Id, "添加配置信息", string.Format("信息={0},结果:{1}", param, res)); } catch (Exception ex) { await _logServices.WriteExceptionLog(LoginUser.Id, "添加配置信息", ex.ToString()); result.code = ResponseCode.Fail; result.msg = "添加配置信息失败," + ex.ToString(); } return(Json(result)); }
/// <summary> /// 编辑配置信息 /// </summary> /// <param name="param"></param> /// <returns></returns> public async Task <ActionResult> EditInfoConfig(string param) { JsonResponse result = new JsonResponse(); try { InfoConfigEntity entity = JsonConvert.DeserializeObject <InfoConfigEntity>(param); var old = await _infoConfigServices.QueryById(entity.Id); entity.CreationTime = old.CreationTime; var res = await _infoConfigServices.UpdateInfoConfig(entity); //更新数据库 await _logServices.WriteSystemLog(LoginUser.Id, "编辑配置信息", string.Format("信息={0},结果:{1}", param, res)); } catch (Exception ex) { await _logServices.WriteExceptionLog(LoginUser.Id, "编辑配置信息", ex.ToString()); result.code = ResponseCode.Fail; result.msg = "编辑配置失败," + ex.ToString(); } return(Json(result)); }