private void DoWork(object state)
        {
            DashBoardRow1WidgetsModel dashBoardRow1WidgetsModel = new DashBoardRow1WidgetsModel();
            var dashBoardRow1WidgetsModelTask = Task.Run(() =>
                                                         this._iDashBoardService.GetBoardRow1WidgetsDetails()
                                                         );
            string content;
            var    vv = new PhysicalFileProvider(
                Path.Combine(Directory.GetCurrentDirectory()));

            using (StreamReader sr = new StreamReader(vv.Root + "Areas/DashBoard/Views/DashBoard/_DashBoardRow1Widgets.cshtml"))
            {
                content = sr.ReadToEnd();
            }

            var engine = new RazorLightEngineBuilder()
                         .UseMemoryCachingProvider()
                         .Build();

            dashBoardRow1WidgetsModelTask.Wait();
            dashBoardRow1WidgetsModel = dashBoardRow1WidgetsModelTask.Result;

            DashBoardWidgetsDTO dashBoardWidgetsDTO = new DashBoardWidgetsDTO();

            dashBoardWidgetsDTO.DashBoardRow1WidgetsViewModel = new DashBoardRow1WidgetsViewModel();
            dashBoardWidgetsDTO.DashBoardRow1WidgetsViewModel = _mapper.Map <DashBoardRow1WidgetsViewModel>(dashBoardRow1WidgetsModel);

            var serviceScheduled = ApplicationGlobalVariables.ServiceScheduled;

            dashBoardWidgetsDTO.DashBoardRow1WidgetsViewModel.TotalNoOfServicesScheduled =
                serviceScheduled.Keys.Count.ToString();

            var servicesDown = serviceScheduled.Values.Where(s => s.UpdatedOn <= DateTime.Now.AddSeconds(-30))
                               .Count();

            dashBoardWidgetsDTO.DashBoardRow1WidgetsViewModel.ServicesLastChecked   = DateTime.Now.ToString();
            dashBoardWidgetsDTO.DashBoardRow1WidgetsViewModel.TotalNoOfServicesDown = servicesDown.ToString();

            var getdashBoardRow1DetailsTask = Task.Run(() =>
                                                       engine.CompileRenderAsync("sdvsdvd", content,
                                                                                 dashBoardWidgetsDTO.DashBoardRow1WidgetsViewModel)
                                                       );

            getdashBoardRow1DetailsTask.Wait();

            string pVdashBoardRow1WidgetsHtml = getdashBoardRow1DetailsTask.Result;

            _hubContext.Clients.All.SendAsync("rUpdateDashBoardRow1Widgets", pVdashBoardRow1WidgetsHtml);
        }
        public IActionResult Index()
        {
            var userIpAddress = this._IHttpContextAccessor
                                .HttpContext.Connection.RemoteIpAddress
                                .ToString();

            if (userIpAddress == "::1")
            {
                userIpAddress = "35.225.15.176";
            }
            DashBoardRow1WidgetsModel dashBoardRow1WidgetsModel = new DashBoardRow1WidgetsModel();
            WeatherWidgetsViewModel   weatherWidgetsViewModel   = new WeatherWidgetsViewModel();
            WeatherModel weatherModel = new WeatherModel();

            DashBoardWidgetsDTO dashBoardWidgetsDTO = new DashBoardWidgetsDTO();

            dashBoardWidgetsDTO.DashBoardRow1WidgetsViewModel = new DashBoardRow1WidgetsViewModel();

            var dashBoardRow1WidgetsModelTask = Task.Run(() =>
                                                         this._iDashBoardService.GetBoardRow1WidgetsDetails()
                                                         );
            var dashBoardWeatherWidgetTask = Task.Run(() =>
                                                      this._iDashBoardService.GetCurrectWeatherDetails(userIpAddress)
                                                      );

            Task.WhenAll(dashBoardRow1WidgetsModelTask, dashBoardWeatherWidgetTask);

            dashBoardRow1WidgetsModel = dashBoardRow1WidgetsModelTask.Result;
            dashBoardWidgetsDTO.DashBoardRow1WidgetsViewModel = _mapper.Map <DashBoardRow1WidgetsViewModel>(dashBoardRow1WidgetsModel);

            weatherModel = dashBoardWeatherWidgetTask.Result;
            dashBoardWidgetsDTO.DashBoardRow2WidgetsViewModel = new DashBoardRow2WidgetsViewModel();
            dashBoardWidgetsDTO.DashBoardRow2WidgetsViewModel.WeatherWidgetsViewModel =
                _mapper.Map <WeatherWidgetsViewModel>(weatherModel);

            return(View("Index", dashBoardWidgetsDTO));
        }