public static TransactionDetail Load(dynamic dyn) { Func <dynamic, TransactionDetail> func = (d) => { var result = new TransactionDetail { AccountId = d.account_id, AccountName = d.account_name, Amount = d.amount, Approved = d.approved, CategoryId = d.category_id, CategoryName = d.category_name, Cleared = d.cleared, Date = d.date, Deleted = d.deleted, FlagColor = d.flag_color, ImportId = d.import_id, Memo = d.memo, PayeeId = d.payee_id, PayeeName = d.payee_name, TransactionId = d.id, TransferAccountId = d.transfer_account_id, TransferTransactionId = d.transfer_transaction_id, }; foreach (var s in d.subtransactions) { result.SubTransactions.Add(SubTransaction.Load(s)); } return(result); }; return(YnabApi.ProcessApiResult(dyn, func)); }
public static BudgetDetail Load(dynamic dyn) { Func <dynamic, BudgetDetail> func = (d) => { var result = new BudgetDetail { BudgetId = d.id, CurrencyFormat = CurrencyFormat.Load(d.currency_format), DateFormat = DateFormat.Load(d.date_format), FirstMonth = d.first_month, LastModifiedOn = d.last_modified_on, LastMonth = d.last_month, Name = d.name, }; foreach (var a in d.accounts) { result.Accounts.Add(Account.Load(a)); } foreach (var p in d.payees) { result.Payees.Add(Payee.Load(p)); } foreach (var l in d.payee_locations) { result.PayeeLocations.Add(PayeeLocation.Load(l)); } foreach (var g in d.category_groups) { result.CategoryGroups.Add(CategoryGroup.Load(g)); } foreach (var c in d.categories) { result.Categories.Add(Category.Load(c)); } foreach (var m in d.months) { result.Months.Add(MonthDetail.Load(m)); } foreach (var t in d.transactions) { result.Transactions.Add(TransactionSummary.Load(t)); } foreach (var s in d.subtransactions) { result.SubTransactions.Add(SubTransaction.Load(s)); } foreach (var s in d.scheduled_transactions) { result.ScheduledTransactions.Add(ScheduledTransactionSummary.Load(s)); } foreach (var s in d.scheduled_subtransactions) { result.ScheduledSubTransactions.Add(ScheduledSubTransaction.Load(s)); } return(result); }; return(YnabApi.ProcessApiResult(dyn, func)); }