public async Task <IActionResult> Update([FromBody] HandicapConfigurationUpdate configUpdate) { var tenantId = this.GetTenantId(); var config = await _configService.Update(configUpdate, tenantId); return(Ok(config)); }
public async Task <HandicapConfiguration> Update(HandicapConfigurationUpdate configUpdate, string tenantId) { var config = await Get(tenantId); var unfinishedMatchDays = await _matchDayRepository.Find(md => md.TenantId == tenantId && !md.IsFinished); if (unfinishedMatchDays.Count() > 0) { throw new EntityClosedForUpdateException($"Cannot update settings. Youn have unfinished MatchDays."); } config.UpdatePlayersImmediately = configUpdate.UpdatePlayersImmediately; config.EightBallMax = configUpdate.EightBallMax; config.NineBallMax = configUpdate.NineBallMax; config.TenBallMax = configUpdate.TenBallMax; config.StraigntPoolMax = configUpdate.StraigntPoolMax; await _configRepo.UpdateConfig(config); return(config); }