public async Task <IActionResult> OnPostFetchRSVPsAsync() { if (!ModelState.IsValid) { return(Page()); } //Clear the existing dataset and session variable RSVPs.Clear(); HttpContext.Session.SetString("currentWinners", ""); List <Attendee> attendees = new List <Attendee>(); string meetupRsvpMemberOnlyUrl = Environment.GetEnvironmentVariable("MEETUP_RSVP_MEMBERONLY_URL"); string queryString = string.Format(meetupRsvpMemberOnlyUrl, GroupName, EventID); queryString = System.Web.HttpUtility.UrlEncode(queryString); string URL = Environment.GetEnvironmentVariable("API_URL"); var client = new RestClient(string.Format("{0}/{1}", URL, queryString)); var request = new RestRequest(Method.GET); request.AddHeader("content-type", "application/json"); string dir = Directory.GetCurrentDirectory(); //Request URL to retrive events; no authentication required IRestResponse response = null; try { // request.AddHeader("authorization", String.Concat("Bearer ", at.AccessToken)); response = await client.ExecuteAsync(request); var cleanJSON = Regex.Unescape(response.Content); var serializedJSON = cleanJSON.Trim('\"'); attendees = JsonConvert.DeserializeObject <List <Attendee> >(serializedJSON); } catch (Exception) { Winner.Name = "Couldn't Fetch details for the given Group / Event!!"; return(Page()); } if (attendees == null) { Winner.Name = "Couldn't Fetch details for the given Group / Event!!"; return(Page()); } foreach (var attendee in attendees) { RSVPs.Add(new RSVP() { Name = attendee.Member.Name, PictureUri = attendee.Member.Photo != null ? attendee.Member.Photo.ThumbLink.ToString() : "" }); } return(Page()); }
public bool IsUserRegistered(string userName) { return(RSVPs.Any(r => r.AttendeeName.Equals(userName, StringComparison.InvariantCultureIgnoreCase))); }
public bool IsUserRegistered(string userName) { return(RSVPs.Any(r => r.AttendeeNameId == userName || (r.AttendeeNameId == null && r.AttendeeName == userName))); }
public bool UserHasRsvp(string userName) { return(RSVPs.Any(x => SecurityHelper.AreUserNamesEqual(x.AttendeeName, userName))); }