Ejemplo n.º 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 IEnumerable <EventBase> Handle(CancelRegistration command)
        {
            var cancelRegistrationEvent = new CancelRegistrationEvent
            {
                Id             = Guid.NewGuid(),
                ConferenceId   = command.ConferenceId,
                RegistrationId = command.RegistrationId,
                Reason         = command.Reason
            };

            yield return(cancelRegistrationEvent);
        }
        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);
        }