コード例 #1
0
        public async Task HandleAsync(CreateConferenceEvent input)
        {
            try
            {
                var conferenceInfo = input.CreateConferenceInfo.MapTo <CreateConference, ConferenceInfo>();
                await _conferenceRepository.SaveConference(conferenceInfo);

                await _conferenceRepository.CommitAsync();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
コード例 #2
0
        public async Task HandleAsync(AddSeatTypeCommand command)
        {
            var conference = await _conferenceRepository.GetConference(command.AggregateRootId);

            List <SeatType> seatTypeList = new List <SeatType>();
            var             seatType     = new SeatType("舒适型", 60, 20, command.AggregateRootId);
            var             seatType1    = new SeatType("豪华型", 80, 10, command.AggregateRootId);

            seatTypeList.Add(seatType);
            seatTypeList.Add(seatType1);
            conference.AddSeatType(seatTypeList);
            await _conferenceRepository.ModifyConference(conference);

            await _conferenceRepository.CommitAsync();

            //await _publishDomainEvent.PublishEventAsync(conference);
        }