Example #1
0
        public static async Task Handle(CancelRegistrationEvent cancelRegistrationEvent)
        {
            var dl         = new HandlerDataLayer();
            var conference = await dl.GetConferenceItemById(cancelRegistrationEvent.ConferenceId);

            var registration = conference.Attendees.First(x => x.RegistrationId == cancelRegistrationEvent.RegistrationId);
            var item         = await dl.GetAttendeeListItemByEmail(registration.Email);

            item.Count--;
            await dl.SaveAttendeeListItem(item);
        }
        public static async Task Handle(CancelRegistrationEvent cancelRegistrationEvent)
        {
            var dl         = new HandlerDataLayer();
            var conference = await dl.GetConferenceItemById(cancelRegistrationEvent.ConferenceId);

            var attendee = conference.Attendees.FirstOrDefault(x => x.RegistrationId == cancelRegistrationEvent.RegistrationId);

            if (attendee != null)
            {
                conference.Attendees.Remove(attendee);
            }
            await dl.SaveConferenceItem(conference);
        }
        public static async Task Handle(NewRegistrationEvent newRegistrationEvent)
        {
            var dl         = new HandlerDataLayer();
            var conference = await dl.GetConferenceItemById(newRegistrationEvent.ConferenceId);

            conference.Attendees.Add(new Attendee
            {
                Name           = newRegistrationEvent.Name,
                FirstName      = newRegistrationEvent.FirstName,
                Email          = newRegistrationEvent.Email,
                Company        = newRegistrationEvent.Company,
                RegistrationId = newRegistrationEvent.Id
            });
            await dl.SaveConferenceItem(conference);
        }