public void OnGet() { var userClaims = HttpContext.User.Claims; UserName = userClaims.FirstOrDefault(c => c.Type.Equals("preferred_username")).Value; FullName = userClaims.FirstOrDefault(c => c.Type.Equals("name")).Value; Email = userClaims.FirstOrDefault(c => c.Type.Equals("email")).Value; var currentUserId = HttpContext.User.Claims .FirstOrDefault(cl => cl.Type.Equals("sub")) ?.Value; Appointments = _appointmentsService.GetConfirmedByCustomerId(currentUserId).ToList(); if (Appointments.Count != 0) { HashSet <int> offerIds = Appointments.Select(a => a.offerId).ToHashSet(); Dictionary <int, OfferViewModel> offers = _offersService.GetManyByIds(offerIds.ToArray(), true); Appointments.ForEach(a => a.offer = offers[a.offerId]); } Console.WriteLine(); }