public IActionResult UpdateEvent([FromBody] MeetupEvent e) { e.EventDate = DateTime.ParseExact(e.EventTime, "yyyy-MM-dd", CultureInfo.InvariantCulture); bool updateSucceeded = _repository.UpdateMeetupEvent(e); return(Ok()); }
public ActionResult GetEvents() { MeetupEventsModel model = new MeetupEventsModel { Items = new MeetupItem[0] }; try { string configPath = Server.MapPath("~/config/MeetupUmbracoGroups.txt"); if (!System.IO.File.Exists(configPath)) { LogHelper.Debug <MeetupsController>("Config file was not found: " + configPath); return(PartialView("~/Views/Partials/Home/Meetups.cshtml", model)); } // Get the alias (urlname) of each group from the config file string[] aliases = System.IO.File.ReadAllLines(configPath).Where(x => x.Trim() != "").Distinct().ToArray(); model.Items = ApplicationContext.ApplicationCache.RuntimeCache.GetCacheItem <MeetupItem[]>("UmbracoSearchedMeetups", () => { // Initialize a new service instance (we don't specify an API key since we're accessing public data) MeetupService service = new MeetupService(); List <MeetupItem> items = new List <MeetupItem>(); foreach (string alias in aliases) { try { // Get information about the group MeetupGroup group = service.Groups.GetGroup(alias).Body; if (group.JObject.HasValue("next_event")) { string nextEventId = group.JObject.GetString("next_event.id"); // Make the call to the Meetup.com API to get upcoming events MeetupGetEventsResponse res = service.Events.GetEvents(alias); // Get the next event(s) MeetupEvent nextEvent = res.Body.FirstOrDefault(x => x.Id == nextEventId); // Append the first event of the group if (nextEvent != null) { items.Add(new MeetupItem(group, nextEvent)); } } } catch (Exception ex) { LogHelper.Error <MeetupsController>("Could not get events from meetup.com for group with alias: " + alias, ex); } } return(items.OrderBy(x => x.Event.Time).ToArray()); }, TimeSpan.FromMinutes(30)); } catch (Exception ex) { LogHelper.Error <MeetupsController>("Could not get events from meetup.com", ex); } return(PartialView("~/Views/Partials/Home/Meetups.cshtml", model)); }
static void Main(string[] args) { var settings = new MeetupSettings { MeetupApiKey = string.Empty, GroupName = string.Empty, MaxWinners = 10, TimeOfEvent = null }; try { var meetupEvent = new MeetupEvent(settings); meetupEvent.GetGroupDetails(); meetupEvent.GetCurrentEventDetails(); meetupEvent.GetParticipants(); meetupEvent.PresentEventWinners(); } catch (Exception ex) { Console.WriteLine("Exception occured: " + ex); } Console.ReadLine(); }
public void TestParseNamePerson() { var name = "Paul D. Sheriff - Architecting Applications for Multiple-User-Interfaces"; var e = new MeetupEvent().ParseName(name); Approvals.Verify(e); }
private MeetupEvent CreateData(DateTime created) { var eventMeetup = new MeetupEvent(DateTime.Now.AddDays(5), DateTime.Now.AddDays(5)); _context.Meetups.Add(eventMeetup); _context.Entry(eventMeetup).Property("Created").CurrentValue = created; _context.Entry(eventMeetup).Property("LastModified").CurrentValue = created; _context.SaveChanges(); return(eventMeetup); }
public bool DeleteMeetupSpeaker(int speakerID) { MeetupEvent meetupSpeaker = _ctx.MeetupEvents.Find(speakerID); if (meetupSpeaker == null) { return(false); } _ctx.MeetupEvents.Remove(meetupSpeaker); return(SaveChanges()); }
public bool DeleteMeetupEvent(int eventID) { MeetupEvent meetupEvent = _ctx.MeetupEvents.Find(eventID); if (meetupEvent == null) { return(false); } _ctx.MeetupEvents.Remove(meetupEvent); return(SaveChanges()); }
private IOutputSpeech GetSpeechResponse(MeetupEvent lastEvent) { string formattedDate = GetFormattedDate(lastEvent.LocalDate); string formattedTime = GetFormattedTime(lastEvent.Time); string speechText = "Le dernier événement a eu lieu le {0} à {1}, le sujet était {2}."; string text = string.Format(speechText, formattedDate, formattedTime, lastEvent.Name); return(new SsmlOutputSpeech { Ssml = $"<speak>{text}</speak>" }); }
private IOutputSpeech GetSpeechResponse(MeetupEvent nextEvent) { string formattedDate = GetFormattedDate(nextEvent.LocalDate); string formattedTime = GetFormattedTime(nextEvent.Time); string speechText = "Le prochain événement aura lieu le {0} à {1}, le sujet est {2}."; string text = string.Format(speechText, formattedDate, formattedTime, nextEvent.Name); return(new SsmlOutputSpeech { Ssml = $"<speak>{text}</speak>" }); }
private SkillResponse GetResponseFromEvents(List <MeetupEvent> events) { if (events == null || !events.Any(e => e != null)) { string speechText = "Quelque chose cloche, je n'ai trouvé aucun événement antérieur."; return(ResponseBuilder.Tell(speechText)); } MeetupEvent lastEvent = events.First(); IOutputSpeech speechResponse = GetSpeechResponse(lastEvent); return(ResponseBuilder.Tell(speechResponse)); }
private SkillResponse GetResponseFromEvents(List <MeetupEvent> events) { if (events == null || !events.Any(e => e != null)) { string speechText = "Il n'y a présentement pas de prochain événement annoncé."; return(ResponseBuilder.Tell(speechText)); } MeetupEvent nextEvent = events.First(); IOutputSpeech speechResponse = GetSpeechResponse(nextEvent); return(ResponseBuilder.Tell(speechResponse)); }
public bool UpdateMeetupEvent(MeetupEvent e) { var obj = _ctx.MeetupEvents.Single(y => y.Id == e.Id); if (obj == null) { return(false); } obj.EventDate = e.EventDate; obj.EventDescription = e.EventDescription; obj.EventName = e.EventName; obj.SpeakerId = e.SpeakerId; return(SaveChanges()); }
public void Crete_New_MeetupEvent_Add_Assistants() { var meetupEvent = new MeetupEvent(); _context.Add(meetupEvent); _context.SaveChanges(); meetupEvent.AddAssistant(_context.Users.First()); _context.SaveChanges(); meetupEvent.Assistants.Count().Should().Be(1); _context.Remove(meetupEvent); _context.SaveChanges(); }
public void Crete_New_MeetupEvent_Add_Assistants() { //TODO: 04 - Creo un nuevo evento y le agrego un asistente var meetupEvent = new MeetupEvent(); _context.Add(meetupEvent); _context.SaveChanges(); meetupEvent.AddAssistant(_context.Users.First()); _context.SaveChanges(); meetupEvent.Assistants.Count().Should().Be(1); _context.Remove(meetupEvent); _context.SaveChanges(); }
public void Throw_Exception_About_Required_ShadowProperty() { //TODO: 02 - Inserto una entidad con shadow property requerida en null var eventMeetup = new MeetupEvent(DateTime.Now.AddDays(5), DateTime.Now.AddDays(5)); _context.Meetups.Add(eventMeetup); var timesTamp = DateTime.Now; _context.Entry(eventMeetup).Property("Created").CurrentValue = null; _context.Entry(eventMeetup).Property("LastModified").CurrentValue = timesTamp; Action act = () => _context.SaveChanges(); act.Should().Throw <InvalidOperationException>(); }
public static void GetEvents(Meetup meetup) { foreach (Group group in meetup.Groups) { string url = string.Format("https://api.meetup.com/2/events?group_id={0}&page=20&access_token={1}", group.Id, meetup.AccessToken); string response = GetResponse(url); try { JavaScriptSerializer serializer = new JavaScriptSerializer(); Dictionary<string, object> dict = serializer.Deserialize<Dictionary<string, object>>(response); IEnumerable events = dict["results"] as IEnumerable; foreach (dynamic evt in events) { MeetupEvent me = new MeetupEvent(); meetup.MeetupEvents.Add(me); me.Id = evt["id"].ToString(); me.Name = evt["name"].ToString(); } } catch { } } }
public void CreateEvent(MeetupEvent meetupEvent) { _repository.CreateEvent(meetupEvent); }
public bool AddMeetupEvent(MeetupEvent e) { _ctx.MeetupEvents.Add(e); return(SaveChanges()); }
public void CreateEvent(MeetupEvent meetupEvent) { _context.MeetupEvents.Add(meetupEvent); _context.SaveChanges(); }
public void CreateEvent(MeetupEvent meetupEvent) { _service.CreateEvent(meetupEvent); }
public MeetupItem(MeetupGroup group, MeetupEvent ev) { Group = group; Event = ev; }