public IActionResult Index() { var authData = HttpContext.Session.GetString("userInfo"); if (authData != "") { User user = JsonConvert.DeserializeObject <User>(authData); HttpContext.Session.SetInt32("UserId", user.Id); HttpContext.Session.SetString("UserName", user.Name); ViewData["NoOfProjects"] = homeManager.NumberOfProjects(); ViewData["NoOfTasks"] = homeManager.NumberOfTasks(); ViewData["NoOfNewTasks"] = homeManager.NewTasks(user.Id); ViewData["NoOfNewComments"] = homeManager.NumberOfNewComments(user.Id); ViewBag.NewTasks = homeManager.NewTaskList(user.Id); ViewBag.NewComments = homeManager.GetNewCommentList(user.Id); List <int> projects = homeManager.GetProjectNumberByMonth(); ViewData["Jan"] = projects[0]; ViewData["Feb"] = projects[1]; ViewData["Mar"] = projects[2]; ViewData["Apr"] = projects[3]; ViewData["May"] = projects[4]; ViewData["Jun"] = projects[5]; ViewData["Jul"] = projects[6]; ViewData["Aug"] = projects[7]; ViewData["Sept"] = projects[8]; ViewData["Oct"] = projects[9]; ViewData["Nov"] = projects[10]; ViewData["Dec"] = projects[11]; List <int> projectCount = homeManager.ThisAndLastTwoYearProjectNumber(); ViewData["ThisYear"] = projectCount[0]; ViewData["LastYear"] = projectCount[1]; ViewData["PrevLastYear"] = projectCount[2]; return(View()); } else { HttpContext.Session.SetString("userInfo", ""); HttpContext.Session.SetInt32("UserId", -9999); HttpContext.Session.SetString("UserName", ""); return(RedirectToAction("Login", "LogIn")); } }