/// <summary> /// 设置平台信息 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <SetPlatformOutput> SetPlatform(SetPlatformInput input) { try { _dbContext.Ado.BeginTran(); var model = _mapper.Map <PlatformInfo>(input); if (model.Id > 0) { await _dbContext.Updateable(model).ExecuteCommandAsync(); } else { model.AddTime = DateTime.Now; model.IsDel = false; await _dbContext.Insertable(model).ExecuteCommandAsync(); } var redis = _redisClient.GetDatabase(_configCenter.StringGet(SysConfig.RedisConnectionKey), 2); await redis.KeyDeleteAsync(CacheKeys.PlatformKey); _dbContext.Ado.CommitTran(); } catch (Exception ex) { _dbContext.Ado.RollbackTran(); throw new Exception("事务执行失败", ex); } return(new SetPlatformOutput { }); }
public BaseOutput SetPlatform([FromBody] SetPlatformInput input) { var model = _mapper.Map <PlatformModel>(input); if (model.Id > 0) { _adminDbContext.Updateable(model).ExecuteCommand(); } else { model.AddTime = DateTime.Now; model.IsDel = false; _adminDbContext.Insertable(model).ExecuteCommand(); } return(new BaseOutput { }); }
/// <summary> /// 设置平台信息 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <SetPlatformOutput> SetPlatform(SetPlatformInput input) { var model = _mapper.Map <PlatformInfo>(input); if (model.Id > 0) { await _dbContext.Updateable(model).ExecuteCommandAsync(); } else { model.AddTime = DateTime.Now; model.IsDel = false; await _dbContext.Insertable(model).ExecuteCommandAsync(); } var redis = _redisClient.GetDatabase(_configCenter.StringGet(SysConfig.RedisConnectionKey), 2); await redis.KeyDeleteAsync(CacheKeys.PlatformKey); return(new SetPlatformOutput { }); }
public async Task <SetPlatformOutput> SetPlatform([FromBody] SetPlatformInput input) { return(await _platformBusiness.SetPlatform(input)); }