Esempio n. 1
0
        private static Event ParseEvent(XElement xEvent)
        {
            var eventObj = new Event
             {
            Title = ParseStringElement(xEvent.Element("title")),
            Description = ParseStringElement(xEvent.Element("description")),
            StartTime = ParseDateTimeElement(xEvent.Element("start_time")),
            StopTime = ParseDateTimeElement(xEvent.Element("stop_time")),
            Price = ParseStringElement(xEvent.Element("price")),
            VenueAddress = ParseMultipleStringsIntoCommaSeparatedString(new[] { xEvent.Element("region_name"), xEvent.Element("city_name"), xEvent.Element("venue_address") })
             };

             var venueDisplay = ParseStringElement(xEvent.Element("venue_display"));
             if (venueDisplay == "1")
             {
            eventObj.VenueName = ParseStringElement(xEvent.Element("venue_Name"));
             }

             var element = xEvent.Element("performers");
             if (element != null)
            foreach (var performer in element.Elements("performer").Select(xElement => new Performer
            {
               Name = ParseStringElement(xElement.Element("name")),
               Bio = ParseStringElement(xElement.Element("short_bio"))
            }))
            {
               eventObj.Performers.Add(performer);
            }

             var imageElement = xEvent.Element("image");
             if (imageElement != null && imageElement.Element("medium") != null)
             {
            var mediumImageElement = imageElement.Element("medium");
            if (mediumImageElement != null)
               eventObj.Image = new ImageLink { Link = ParseStringElement(mediumImageElement.Element("url")) };
             }

             var categoriesElement = xEvent.Element("categories");
             if (categoriesElement != null)
            foreach (var xElement in categoriesElement.Elements("category"))
            {
               eventObj.Categories.Add(ParseStringElement(xElement.Element("name")));
            }

             return eventObj;
        }
Esempio n. 2
0
 public static void Add(Event myEvent)
 {
     eventList.Add(myEvent);
 }
Esempio n. 3
0
 public void AddEvent(Event myEvent)
 {
     EventRepository.Add(myEvent);
 }