public async Task <IActionResult> Index(string user, int roleid) { var cookieValue = ""; var role = 1; if (user == null) { cookieValue = HttpContext.Session.GetString("user"); role = Convert.ToInt32(HttpContext.Session.GetInt32("position")); } else { HttpContext.Session.SetString(SessionKeyName, user); HttpContext.Session.SetInt32(SessionKeyRole, roleid); } cookieValue = HttpContext.Session.GetString("user"); role = Convert.ToInt32(HttpContext.Session.GetInt32("position")); var homemodel = new GeneralFilter { roleid = role, username = cookieValue, Crimes = await StaticDataHandler.GetCrimes("https://localhost:44311/api/") }; return(View(homemodel)); }