public async Task <MainDashboardResponse> GetMainDashboardData()
        {
            MainDashboardResponse mainDashboard = new MainDashboardResponse();
            MainDashboardDal      MainDashDal   = new MainDashboardDal();
            OlderVersionDal       oldVersionDal = new OlderVersionDal();

            byte[] imageBytes = MainDashDal.GetTimeLine();
            mainDashboard.TimeLine = imageBytes != null ? "data:image/png;base64," + Convert.ToBase64String(imageBytes, Base64FormattingOptions.None) : null;

            var oldVersionList = MainDashDal.GetLastApplicationVersions();
            List <ApplicationOlderVersionGradeResponse> appOldVerList = new List <ApplicationOlderVersionGradeResponse>();

            foreach (var item in oldVersionList)
            {
                var topDateTime    = item.GAQuelityGrade > 0 && item.GADateTime != DateTimeOffset.MinValue ? item.GADateTime : DateTimeOffset.MinValue;
                var oldVersionItem = new ApplicationOlderVersionGradeResponse
                {
                    ApplicationVersion = item.ApplicationVersion,
                    GAQualityGrade     = item.GAQuelityGrade,
                    GADateTime         = item.GADateTime.ToString("dd/MM/yy") != "01/01/00" ? item.GADateTime.ToString("dd/MM/yy") : "",
                    RC1QualityGrade    = item.RC1QuelityGrade,
                    RC1DateTime        = item.RC1DateTime.ToString("dd/MM/yy") != "01/01/00" ? item.RC1DateTime.ToString("dd/MM/yy") : "",
                    RC1ActualGrade     = await Rc1ActualGrade(item.RC1QuelityGrade, item.ApplicationVersion, item.RC1DateTime, topDateTime)
                };
                if (item.GAQuelityGrade > 0)
                {
                    oldVersionItem.GAActualGrade = await GaActualGrade(item.GAQuelityGrade, item.ApplicationVersion, item.GADateTime);
                }
                appOldVerList.Add(oldVersionItem);
            }



            mainDashboard.OldVersionApplicationList   = appOldVerList;
            mainDashboard.CurrentApplicationKPIsGrade = await GetApplicationGrade();

            var currentVersionNumber = oldVersionDal.GetCurrentVersion();

            mainDashboard.CurrentEngineKPIsGrade = await GetEngineGrade(currentVersionNumber.EngineVersionNumber);

            List <OlderInformationChart> oldEngineGrades = new List <OlderInformationChart>();

            var oldEngineVersionList = oldVersionDal.GetLastOldEngineVersion();

            foreach (var item in oldEngineVersionList)
            {
                oldEngineGrades.Add(await GetEngineGrade(item.EngineVersionNumber));
            }

            mainDashboard.OldVersionEngineList = oldEngineGrades;

            mainDashboard.SmokeGrades = GetSmokeGrades();

            mainDashboard.EngineCodeCoverage = await GetCodeCoverageGrade(StaticParams.EngineBuildDefinition);

            mainDashboard.ApplicationCodeCoverage = await GetCodeCoverageGrade(StaticParams.AppBuildDefinition);

            return(mainDashboard);
        }