private static ManagementGroupRates Map( LocalDomainModels.LocalAuthorityInformation localAuthorityInformation) { ManagementGroupRates toReturn = null; ProvisionalFunding provisionalFunding = Map(localAuthorityInformation.ProvisionalFunding); toReturn = new ManagementGroupRates() { ProvisionalFunding = provisionalFunding, }; return(toReturn); }
private async Task <IActionResult> ExecuteValidatedRequestAsync( int year, short laNumber, string fields, CancellationToken cancellationToken) { IActionResult toReturn = null; try { ManagementGroupRates managementGroupRates = await this.managementGroupRatesManager.GetManagementGroupRatesAsync( year, laNumber, fields, cancellationToken) .ConfigureAwait(false); managementGroupRates.Name = $"Management Group Rates for year {year} " + $"({nameof(laNumber)}: {laNumber})"; JsonSerializerSettings jsonSerializerSettings = JsonConvert.DefaultSettings(); if (jsonSerializerSettings == null) { toReturn = new JsonResult(managementGroupRates); } else { toReturn = new JsonResult( managementGroupRates, jsonSerializerSettings); } } catch (RatesNotFoundException) { toReturn = this.httpErrorBodyResultProvider.GetHttpErrorBodyResult( HttpStatusCode.NotFound, 6, year.ToString(CultureInfo.InvariantCulture), laNumber.ToString(CultureInfo.InvariantCulture)); } return(toReturn); }
/// <inheritdoc /> public async Task <ManagementGroupRates> GetManagementGroupRatesAsync( int year, short laNumber, string fields, CancellationToken cancellationToken) { ManagementGroupRates toReturn = null; LocalDomainModels.LocalAuthorityInformation localAuthorityInformation = await this.localAuthorityInformationStorageAdapter.GetLocalAuthorityInformationAsync( year, laNumber, cancellationToken) .ConfigureAwait(false); toReturn = Map(localAuthorityInformation); if (!string.IsNullOrEmpty(fields)) { toReturn = toReturn.Pick(fields); } return(toReturn); }