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 Task Handle(AddConferenceEvent addConferenceEvent) { var dl = new HandlerDataLayer(); var item = new ConferenceListItem { ConferenceId = addConferenceEvent.Id, Name = addConferenceEvent.Name, Start = addConferenceEvent.Start, End = addConferenceEvent.End }; return(dl.SaveConferenceListItem(item)); }
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); }
public static Task Handle(AddConferenceEvent addConferenceEvent) { var dl = new HandlerDataLayer(); var item = new ConferenceItem { ConferenceId = addConferenceEvent.Id, Name = addConferenceEvent.Name, Start = addConferenceEvent.Start, End = addConferenceEvent.End, Description = addConferenceEvent.Description, RegistrationStart = addConferenceEvent.RegistrationStart, RegistrationEnd = addConferenceEvent.RegistrationEnd, Attendees = new List <Attendee>() }; return(dl.SaveConferenceItem(item)); }
public static async Task Handle(NewRegistrationEvent newRegistrationEvent) { var dl = new HandlerDataLayer(); var item = await dl.GetAttendeeListItemByEmail(newRegistrationEvent.Email); if (item == null) { item = new AttendeeListItem { Email = newRegistrationEvent.Email, Count = 0 }; } item.Name = newRegistrationEvent.Name; item.FirstName = newRegistrationEvent.FirstName; item.Company = newRegistrationEvent.Company; item.Count++; await dl.SaveAttendeeListItem(item); }