Exemplo n.º 1
0
        public async Task <string> Handle(AddNewCalendarEventCommand command, CancellationToken cancellationToken)
        {
            var calendarEvent = new CalendarEvent(
                command.Name,
                command.Time,
                command.Location,
                command.EventOrganizer
                );

            foreach (var memberName in command.Members)
            {
                calendarEvent.AddMember(memberName);
            }

            await _calendarEventRepository.Insert(calendarEvent);

            return(calendarEvent.Id);
        }