public IActionResult Basket() { if (!User.Identity.IsAuthenticated) { return(this.Redirect("~/Identity/Account/Login")); } var id = User.GetUserId(); User user = UserRepo.Get(id); if (user.Basket == null) { user.Basket = new Basket(); UserRepo.SaveChanges(); } List <Movie> movies = new List <Movie>(); foreach (var item in user.Basket.UserBasket.Ids) { movies.Add(MovieRepo.Get(item)); } return(View(movies)); }