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")); } }
public IActionResult NomineeList(string year) { if (HttpContext.Session.GetString("AdminID") != null) { List <NomineeDetail> NomineeList = new List <NomineeDetail>(); NomineeMethod nm = new NomineeMethod(); string error = ""; NomineeList = nm.GetNomineeListByYear(Convert.ToInt16(year), out error); ViewBag.error = error; return(View(NomineeList)); } else { return(RedirectToAction("AdminLogin")); } }
public IActionResult AllNominees() { 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(); string error = ""; NomineeList = nm.GetNomineeListByYear(year, out error); ViewBag.error = error; return(View(NomineeList)); } else { HttpContext.Session.SetString("fromWhere", "FromVoteOn"); return(View("Login")); } }