public async Task <IActionResult> UpdateSetting([FromBody] OperateLogSettingViewModel viewModel) { var isSuccess = await _operateLogService.UpdateOpreateLogSettingAsync(viewModel); if (!isSuccess) { return(this.BadRequestResult("更新失败!")); } return(Ok()); }
/// <summary> /// 更新操作日志配置 /// </summary> public async Task <bool> UpdateOpreateLogSettingAsync(OperateLogSettingViewModel viewModel) { try { var setting = await _logSettingRepository.GetAsync(viewModel.Id); setting.SaveTime = viewModel.SaveTime; setting.IsRecord = viewModel.IsRecord; _logSettingRepository.Update(setting); await _unitOfWork.SaveAsync(); // 清除setting缓存 _logSettingCache.ClearCacheData(); return(true); } catch (Exception e) { _logger.LogError(e.Message); _logger.LogError(e.StackTrace); } return(false); }