/// <summary> /// This action returns Dashboard view with view-model /// </summary> /// <returns></returns> public ActionResult Index() { try { if (SessionManagement.UserInfo != null) { var model = new DashboardModel(); LoginInformation loginInfo = SessionManagement.UserInfo; var userAccInfo = clientAccBO.GetDashboardAccounts(loginInfo.LogAccountType, loginInfo.UserID); //Group all accounts by currency var pairedAccInfo = userAccInfo.GroupBy(o => o.FK_CurrencyID); var tradeList = new List <UserAccountGrouped>(); //Iterate through each currency grouped accounts and add them to model foreach (var item in pairedAccInfo) { var groupedTradingAccount = new UserAccountGrouped(); groupedTradingAccount.AccountCurrency = lCurrValueBO.GetCurrencySymbolFromID((int)item.Key); var list = new List <Client_Account>(); foreach (var groupedItem in item) { list.Add(groupedItem); } groupedTradingAccount.UserAccountList = list; tradeList.Add(groupedTradingAccount); } model.UserAccInformation = tradeList; //Get market news model.MarketNews = GetMarketNews(); //Get IB userID under which client is present int ibUserID = clientBO.GetIntroducingBrokerIDOfClient(loginInfo.UserID); model.BrokerPromoImgName = String.Empty; //If client is under any IB if (ibUserID != 0) { var imgDetail = userImgBO.GetActiveImageOfIB(ibUserID); if (imgDetail != null) { var imgExt = imgDetail.ImageName.Substring(imgDetail.ImageName.LastIndexOf('.')); model.BrokerPromoImgName = imgDetail.PK_UserImageID + imgExt; } } return(View(model)); } else { return(RedirectToAction("Login", "Account")); } } catch (Exception ex) { CurrentDeskLog.Error(ex.Message, ex); return(View("ErrorMessage")); } }