BudgetAnalyser.Engine.Services.BudgetPieGraphService.PrepareIncomeGraphData C# (CSharp) Метод

PrepareIncomeGraphData() публичный Метод

Prepares the income graph data.
public PrepareIncomeGraphData ( [ budget ) : decimal>.IDictionary
budget [
Результат decimal>.IDictionary
        public IDictionary<string, decimal> PrepareIncomeGraphData([NotNull] BudgetModel budget)
        {
            if (budget == null)
            {
                throw new ArgumentNullException(nameof(budget));
            }

            List<KeyValuePair<string, decimal>> list = budget.Incomes
                .Select(income => new KeyValuePair<string, decimal>(income.Bucket.Code, income.Amount))
                .ToList();
            return list.OrderByDescending(x => x.Value)
                .ToDictionary(i => i.Key, i => i.Value);
        }