public IActionResult Index() { //Get Logged In User Id var claimsIdentity = (ClaimsIdentity)User.Identity; var claim = claimsIdentity.FindFirst(ClaimTypes.NameIdentifier); //get all stores IEnumerable <Store> storeList = _homeRepository.GetAllStores(); if (claim != null) { string userId = claim.Value; ApplicationUser applicationUser = _homeRepository.GetUserById(userId); if (applicationUser.DefaultStoreId != 0 && applicationUser.DefaultStoreId != null) { return(RedirectToAction("Index", "ViewInventory", new { id = applicationUser.DefaultStoreId })); } } return(View(storeList)); }