Example #1
0
        public async Task <MeetingResponse> SaveAsync(Meeting meeting)
        {
            try
            {
                await _meetingRepository.AddAsync(meeting);

                await _unitOfWork.CompleteAsync();

                return(new MeetingResponse(meeting));
            }
            catch (Exception ex)
            {
                return(new MeetingResponse($"An error ocurred while saving meeting: {ex.Message}"));
            }
        }
Example #2
0
        public async Task <Unit> Handle(CreateMeetingCommand request, CancellationToken cancellationToken)
        {
            var meetingGroup = await _meetingGroupRepository.GetByIdAsync(new MeetingGroupId(request.MeetingGroupId));

            var hostsMembersIds = request.HostMemberIds.Select(x => new MemberId(x)).ToList();

            var meeting = meetingGroup.CreateMeeting(
                request.Title,
                new MeetingTerm(request.TermStartDate, request.TermStartDate),
                request.Description,
                new MeetingLocation(request.MeetingLocationName, request.MeetingLocationAddress, request.MeetingLocationPostalCode, request.MeetingLocationCity),
                request.AttendeesLimit,
                request.GuestsLimit,
                new Term(request.RSVPTermStartDate, request.RSVPTermEndDate),
                new MoneyValue(request.EventFeeValue, request.EventFeeCurrency),
                hostsMembersIds,
                _memberContext.MemberId);

            await _meetingRepository.AddAsync(meeting);

            return(Unit.Value);
        }
Example #3
0
        public async Task <Guid> Handle(CreateMeetingCommand request, CancellationToken cancellationToken)
        {
            var meetingGroup = await _meetingGroupRepository.GetByIdAsync(new MeetingGroupId(request.MeetingGroupId));

            var hostsMembersIds = request.HostMemberIds.Select(x => new MemberId(x)).ToList();

            var meeting = meetingGroup.CreateMeeting(
                request.Title,
                MeetingTerm.CreateNewBetweenDates(request.TermStartDate, request.TermStartDate),
                request.Description,
                MeetingLocation.CreateNew(request.MeetingLocationName, request.MeetingLocationAddress, request.MeetingLocationPostalCode, request.MeetingLocationCity),
                request.AttendeesLimit,
                request.GuestsLimit,
                Term.CreateNewBetweenDates(request.RSVPTermStartDate, request.RSVPTermEndDate),
                request.EventFeeValue.HasValue ? MoneyValue.Of(request.EventFeeValue.Value, request.EventFeeCurrency) : MoneyValue.Undefined,
                hostsMembersIds,
                _memberContext.MemberId);

            await _meetingRepository.AddAsync(meeting);

            return(meeting.Id.Value);
        }