public TrustFundModel GetTrustFundDetails(int trustFundId)
{
TrustFundModel trustFundModel = new TrustFundModel();
var trustFundDetails = (from trustFund in dbContext.tblTrustFunds
join trustFundDetail in dbContext.tblTrustFundDetails on trustFund.Id equals trustFundDetail.TrustFundId
join fundSource in dbContext.tblFundSources on trustFundDetail.TFDFundSourceId equals fundSource.Id
where trustFund.Id == trustFundId
select new
{
Id = trustFund.Id,
TFIdentifier = trustFund.TFIdentifier,
FundSourceName = fundSource.FundSourceName,
FundSourceId = trustFundDetail.TFDFundSourceId,
Amount = trustFundDetail.TFDAmountInUSD,
}).ToList();
trustFundModel.TrustFundId = trustFundDetails.n(0).Id;
trustFundModel.TFIdentifier = trustFundDetails.n(0).TFIdentifier;
foreach (var trustFundDetail in trustFundDetails)
{
var tr = new transaction
{
transactiontype = new transactionTransactiontype { code = ConvertIATIv2.gettransactionCode("C") },
providerorg = new transactionProviderorg { narrative = Statix.getNarativeArray(trustFundDetail.FundSourceName) },
value = new currencyType { currency = Statix.Currency, Value = trustFundDetail.Amount ?? 0 },
};
new AimsDbIatiDAL().SetCurrencyExRateAndVal(tr, Statix.Currency);
trustFundModel.transactionsInAims.Add(tr);
}
return trustFundModel;
}