public IHttpActionResult GetDashboardData(int id)
        {
            //if user is not admin return..
            var    identity = User.Identity as ClaimsIdentity;
            string userRole = identity.FindFirst(ClaimTypes.Role).Value;
            int    userId   = int.Parse(identity.FindFirst(ClaimTypes.SerialNumber).Value);

            if (userRole != "admin" && userId != id)
            {
                //ModelState.AddModelError("InvalidAccess", "You are not authorized !");
                return(BadRequest("UnauthorizedAccess"));
            }
            DashboardData dbData        = new DashboardData();
            ClientFunding clientFunding = new ClientFunding();
            Dictionary <string, List <DashboardReportData> > assetClassesData = clientFunding.GetAssetClassesReportData(id);
            List <DashboardReportData> assetClassesReportData                = assetClassesData["All"];
            List <DashboardReportData> assetClassesComparisonReportData      = assetClassesData["Growth"];
            Dictionary <string, List <DashboardReportData> > assetWealthData = clientFunding.GetNetWealthReportData(id);
            List <DashboardReportData> netWealthReportData           = assetWealthData["All"];
            List <DashboardReportData> netWealthComparisonReportData = assetWealthData["Net"];

            foreach (DashboardReportData item in assetClassesReportData)
            {
                switch (item.key)
                {
                case "Attractive Assets":
                    item.color = "darkred"; break;

                case "Int. Shares":
                case "Other Entities Assets":
                    item.color = "red"; break;

                case "Aus. Shares":
                case "Pension Assets":
                    item.color = "orange"; break;

                case "Property":
                case "Super Assets":
                    item.color = "yellow"; break;

                case "Int. Fixed Interest":
                    item.color = "lightgreen"; break;

                case "Aus. Fixed Interest":
                case "Personal Assets":
                    item.color = "green"; break;

                case "Cash":
                    item.color = "darkgreen"; break;
                }
            }

            foreach (DashboardReportData item in netWealthReportData)
            {
                switch (item.key)
                {
                case "Other Entities Assets":
                    item.color = "red"; break;

                case "Pension Assets":
                    item.color = "orange"; break;

                case "Super Assets":
                    item.color = "yellow"; break;

                case "Personal Assets":
                    item.color = "green"; break;
                }
            }

            dbData.AssetClassesReportData           = assetClassesReportData;
            dbData.NetWealthReportData              = netWealthReportData;
            dbData.AssetClassesComparisonReportData = assetClassesComparisonReportData;
            dbData.NetWealthComparisonReportData    = netWealthComparisonReportData;

            dbData.userData    = AppUser.GetById(id);
            dbData.lastFunding = clientFunding.GetLatestClientFunding(dbData.userData.UserEmail);

            AssetAllocationMaster assetAllocationMaster = db.AssetAllocationMasters.Find(dbData.lastFunding.RiskProfile);

            if (assetAllocationMaster != null)
            {
                dbData.lastFunding.ExpectedAttractiveAssets = assetAllocationMaster.AttractiveAssets;
                dbData.lastFunding.ExpectedAusFixedInterest = assetAllocationMaster.AusFixedInterest;
                dbData.lastFunding.ExpectedAusShares        = assetAllocationMaster.AusShares;
                dbData.lastFunding.ExpectedCash             = assetAllocationMaster.Cash;
                dbData.lastFunding.ExpectedIntFixedInterest = assetAllocationMaster.IntFixedInterest;
                dbData.lastFunding.ExpectedIntShares        = assetAllocationMaster.IntShares;
                dbData.lastFunding.ExpectedProperty         = assetAllocationMaster.Property;
            }

            dbData.ExpectedTotalFund = ProjectedData.GetByUserIdAndYear(id, dbData.lastFunding.FundingYear);

            return(Ok(dbData));
        }