public List <AvailableBalanceModel> GetAvailableBalance() { var agents = ent.Agents.OrderBy(x => x.AgentName); List <AvailableBalanceModel> Listmodel = new List <AvailableBalanceModel>(); foreach (var agentinfo in agents) { var data = ent.Air_GetAvailableBalance(agentinfo.AgentId).ToList(); var otherData = data.FirstOrDefault(); AvailableBalanceModel model = new AvailableBalanceModel(); model.CreditLimit = otherData.CreditLimit.Value; model.RemainingBalance = otherData.Amount.Value; model.AgentName = otherData.AgentName; foreach (var currency in data) { CurrencyDetail detail = new CurrencyDetail(); detail.Amount = currency.Amount.ToString(); detail.CreditLimit = currency.CreditLimit.ToString(); detail.CurrenyCode = currency.CurrencyCode.ToString(); detail.LedgerAmount = currency.LedgerAmount.ToString(); model.CurrencyList.Add(detail); // model.Currency = item.CurrencyCode; } Listmodel.Add(model); } return(Listmodel); }
public ActionResult Index() { AvailableBalanceModel model = new AvailableBalanceModel(); //{ // AgentList=pro.GetAllAgentList() //}; model.AvailableBalanceList = pro.GetAvailableBalance(); return(View(model)); }