public FixedIncomeProfileModel GenerateProfile(List<AssetBase> assets) {
     FixedIncomeProfileModel model = new FixedIncomeProfileModel { data = new List<FixedIncomeProfileItem>() };
     foreach (var income in assets.OfType<FixedIncome>()) {
         FixedIncomeProfileItem item = new FixedIncomeProfileItem {
             ticker = income.Ticker,
             fixedIncomeName = income.FixedIncomeName,
             faceValue = income.LatestPrice,
             coupon = income.CouponRate == null ? 0 : (double)income.CouponRate,
             couponFrequency = income.CouponFrequency.ToString(),
             issuer = income.Issuer,
             costValue = income.GetCost().AssetCost,
             totalCostValue = income.GetCost().Total,
             marketValue = income.GetTotalMarketValue(),
             priority = (int)income.BoundDetails.Priority,
             redemptionFeatures = income.BoundDetails.RedemptionFeatures.ToString(),
             bondRating = (double)income.BoundDetails.BondRating,
             ratingAgency = income.BoundDetails.RatingAgency,
         };
         model.data.Add(item);
     }
     return model;
 }
        public FixedIncomeProfileModel GetProfiles_Client()
        {
            Client client = edisRepo.GetClientSync(User.Identity.GetUserId(), DateTime.Now);
            ClientGroup clientGroup = edisRepo.GetClientGroupSync(client.ClientGroupId, DateTime.Now);
            if (clientGroup.MainClientId == client.Id)
            {
                List<GroupAccount> groupAccounts = edisRepo.GetAccountsForClientGroupSync(clientGroup.ClientGroupNumber, DateTime.Now);
                List<ClientAccount> clientAccounts = edisRepo.GetAccountsForClientSync(client.ClientNumber, DateTime.Now);

                FixedIncomeProfileModel model = new FixedIncomeProfileModel { data = new List<FixedIncomeProfileItem>() };

                List<AssetBase> assets = new List<AssetBase>();
                foreach (var account in groupAccounts)
                {
                    assets.AddRange(account.GetAssetsSync());
                }
                foreach (var account in clientAccounts)
                {
                    assets.AddRange(account.GetAssetsSync());
                }
                var incomes = assets.OfType<FixedIncome>();
                foreach (var income in incomes)
                {
                    FixedIncomeProfileItem item = new FixedIncomeProfileItem
                    {
                        ticker = income.Ticker,
                        fixedIncomeName = income.FixedIncomeName,
                        faceValue = income.LatestPrice,
                        coupon = income.CouponRate == null ? 0 : (double)income.CouponRate,
                        couponFrequency = income.CouponFrequency.ToString(),
                        issuer = income.Issuer,
                        costValue = income.GetCost().AssetCost,
                        totalCostValue = income.GetCost().Total,
                        marketValue = income.GetTotalMarketValue(),
                        priority = (int)income.BoundDetails.Priority,
                        redemptionFeatures = income.BoundDetails.RedemptionFeatures.ToString(),
                    };
                    model.data.Add(item);
                }

                return model;

            }
            else
            {
                List<ClientAccount> accounts = edisRepo.GetAccountsForClientSync(client.ClientNumber, DateTime.Now);
                FixedIncomeProfileModel model = new FixedIncomeProfileModel { data = new List<FixedIncomeProfileItem>() };

                List<AssetBase> assets = new List<AssetBase>();
                foreach (var account in accounts)
                {
                    assets.AddRange(account.GetAssetsSync());
                }
                var incomes = assets.OfType<FixedIncome>();
                foreach (var income in incomes)
                {
                    FixedIncomeProfileItem item = new FixedIncomeProfileItem
                    {
                        ticker = income.Ticker,
                        fixedIncomeName = income.FixedIncomeName,
                        faceValue = income.LatestPrice,
                        coupon = income.CouponRate == null ? 0 : (double)income.CouponRate,
                        couponFrequency = income.CouponFrequency.ToString(),
                        issuer = income.Issuer,
                        costValue = income.GetCost().AssetCost,
                        totalCostValue = income.GetCost().Total,
                        marketValue = income.GetTotalMarketValue(),
                        priority = (int)income.BoundDetails.Priority,
                        redemptionFeatures = income.BoundDetails.RedemptionFeatures.ToString(),
                    };
                    model.data.Add(item);
                }

                return model;

            }
        }
 public FixedIncomeProfileModel FixedIncome_GetProfiles_Client(string clientUserId)
 {
     FixedIncomeProfileModel result = new FixedIncomeProfileModel
     {
         data = new List<FixedIncomeProfileItem>
         {
             new FixedIncomeProfileItem{ 
                 ticker= "123444678",
                 fixedIncomeName= "income 1",
                 currency= "USD",
                 faceValue= RandomMoney(),
                 coupon=RandomPercentage(),
                 couponFrequency= "weekly",
                 issuer="issuer 2",
                 costValue= RandomMoney(),
                 brokerage=RandomMoney(),
                 totalCostValue=RandomMoney(),
                 totalCostValueAUD=RandomMoney(),
                 totalCostValueWeighting=RandomPercentage(),
                 totalCostValueAssetAllocationWeighting=RandomPercentage(),
                 marketPrice=RandomMoney(),
                 marketValue=RandomMoney(),
                 marketValueAUD=RandomMoney(),
                 marketValueWeighting=RandomPercentage(),
                 marketValueAssetAllocationWeighting=RandomPercentage(),
                 incomeSuitabilityToInvestor=RandomPercentage(),
                 instrumentType="type 2",
                 bondTerm=rdm.Next() * 12,
                 maturityDate=DateTime.Now,
                 presentValue=RandomMoney(),
                 yieldToMaturity=RandomMoney(),
                 couponRate=RandomPercentage(),
                 interestAccrued=RandomMoney(),
                 bondRating=RandomPercentage(),
                 ratingAgency="Agency",
                 priority= 1,
                 redemptionFeatures= "features"
             },new FixedIncomeProfileItem{ 
                 ticker= "123444678",
                 fixedIncomeName= "income 1",
                 currency= "USD",
                 faceValue= RandomMoney(),
                 coupon=RandomPercentage(),
                 couponFrequency= "weekly",
                 issuer="issuer 2",
                 costValue= RandomMoney(),
                 brokerage=RandomMoney(),
                 totalCostValue=RandomMoney(),
                 totalCostValueAUD=RandomMoney(),
                 totalCostValueWeighting=RandomPercentage(),
                 totalCostValueAssetAllocationWeighting=RandomPercentage(),
                 marketPrice=RandomMoney(),
                 marketValue=RandomMoney(),
                 marketValueAUD=RandomMoney(),
                 marketValueWeighting=RandomPercentage(),
                 marketValueAssetAllocationWeighting=RandomPercentage(),
                 incomeSuitabilityToInvestor=RandomPercentage(),
                 instrumentType="type 2",
                 bondTerm=rdm.Next() * 12,
                 maturityDate=DateTime.Now,
                 presentValue=RandomMoney(),
                 yieldToMaturity=RandomMoney(),
                 couponRate=RandomPercentage(),
                 interestAccrued=RandomMoney(),
                 bondRating=RandomPercentage(),
                 ratingAgency="Agency",
                 priority= 1,
                 redemptionFeatures= "features"
             },new FixedIncomeProfileItem{ 
                 ticker= "123444678",
                 fixedIncomeName= "income 1",
                 currency= "USD",
                 faceValue= RandomMoney(),
                 coupon=RandomPercentage(),
                 couponFrequency= "weekly",
                 issuer="issuer 2",
                 costValue= RandomMoney(),
                 brokerage=RandomMoney(),
                 totalCostValue=RandomMoney(),
                 totalCostValueAUD=RandomMoney(),
                 totalCostValueWeighting=RandomPercentage(),
                 totalCostValueAssetAllocationWeighting=RandomPercentage(),
                 marketPrice=RandomMoney(),
                 marketValue=RandomMoney(),
                 marketValueAUD=RandomMoney(),
                 marketValueWeighting=RandomPercentage(),
                 marketValueAssetAllocationWeighting=RandomPercentage(),
                 incomeSuitabilityToInvestor=RandomPercentage(),
                 instrumentType="type 2",
                 bondTerm=rdm.Next() * 12,
                 maturityDate=DateTime.Now,
                 presentValue=RandomMoney(),
                 yieldToMaturity=RandomMoney(),
                 couponRate=RandomPercentage(),
                 interestAccrued=RandomMoney(),
                 bondRating=RandomPercentage(),
                 ratingAgency="Agency",
                 priority= 1,
                 redemptionFeatures= "features"
             },
         }
     };
     return result;
 }