public IActionResult NomineesToVoteOn() { if (votingOpen == false) { return(View("VotingClosed")); } ViewBag.Name = HttpContext.Session.GetString("UserID"); ViewBag.Admin = HttpContext.Session.GetString("AdminID"); if (ViewBag.Name != null || ViewBag.Admin != null) { int year = DateTime.Now.Year; List <NomineeDetail> NomineeList = new List <NomineeDetail>(); NomineeMethod nm = new NomineeMethod(); UserMethod um = new UserMethod(); string error = ""; NomineeList = nm.GetNomineeListByYear(year, out error); ViewBag.error = error; if (um.GetIfUserHasVooted(HttpContext.Session.GetString("UserID"), out string msg1) || um.GetIfUserHasVooted((ViewBag.Admin), out string msg2)) { return(RedirectToAction("AllNominees")); } else { return(View(NomineeList)); } } else { HttpContext.Session.SetString("fromWhere", "FromVoteOn"); return(View("Login")); } }