public OperationResult <ProviderData[]> GetSubscriberProviders(long subscriberId) { return(InvokeOperations.InvokeOperation(() => { Logger.Trace("Get subscriber providers, subscriber id - {0}", subscriberId); var subscriptions = signalServiceRepository.GetSubscriberProviders(subscriberId); var accountInfos = accService.GetAccountsInfo(subscriptions.Select(x => (long)x.Provider.id).Distinct().ToArray()); if (!accountInfos.IsSuccess) { throw new OperationException(accountInfos.Error, accountInfos.Code); } var providerDatas = new List <ProviderData>(); foreach (var accountInfo in accountInfos.Result) { var info = accountInfo; var provider = subscriptions.First(x => x.Provider.id == info.AccountId); var providerData = new ProviderData { Login = accountInfo.Login, ClientId = provider.Provider.client_account_id, Avatar = accountInfo.Avatar, AccountId = accountInfo.AccountId, AccountType = accountInfo.AccountType, Balance = (decimal)accountInfo.Balance, Nickname = provider.Provider.nickname, SubscriberNickname = provider.Subscriber.nickname, Equity = (decimal)accountInfo.Equity, WorkingDays = info.WorkingDays, Leverage = accountInfo.Leverage, Currency = accountInfo.Currency, Profit = provider.Subscription.slave_profit, Procent = 100 + (((decimal)accountInfo.Balance / 100) * (decimal)(accountInfo.Equity - accountInfo.Balance)) }; providerDatas.Add(providerData); } return providerDatas.ToArray(); })); }