private DistributionPeriod GetDistributionPeriod(string fundingLineCode, string distributionPeriodId) { Guard.IsNullOrWhiteSpace(fundingLineCode, nameof(fundingLineCode)); Guard.IsNullOrWhiteSpace(distributionPeriodId, nameof(distributionPeriodId)); FundingLine fundingLine = FundingLines.SingleOrDefault(fl => fl.FundingLineCode == fundingLineCode); Guard.Ensure(fundingLine != null, $"Did not locate a funding line with code {fundingLineCode}"); DistributionPeriod distributionPeriod = fundingLine.DistributionPeriods? .SingleOrDefault(d => d.DistributionPeriodId == distributionPeriodId); Guard.Ensure(distributionPeriod != null, $"Distribution period {distributionPeriodId} not found for funding line {fundingLineCode}."); return(distributionPeriod); }
public decimal?GetFundingLineTotal(string fundingLineCode) => FundingLines?.FirstOrDefault(_ => _.FundingLineCode == fundingLineCode)?.Value;