public Result Handle(UpdateMeetupCommand command)
        {
            Result result = Result.Successful;

            var meetup = _repository.Load(command.MeetupId);

            if (!meetup.Name.Equals(command.Name, StringComparison.InvariantCulture))
            {
                result = meetup.UpdateName(command.Name);
                if (!result.Success)
                {
                    return(result);
                }
            }
            if (meetup.TotalAvailableSeats != command.SeatsAvailable)
            {
                result = meetup.UpdateAvailableSeats(command.SeatsAvailable);
                if (!result.Success)
                {
                    return(result);
                }
            }

            _repository.Commit();

            return(result);
        }
        public void Handle(CancelSeatReservationCommand command)
        {
            var meetup = _repository.Load(command.MeetupId);

            meetup.CancelSeatReservation(command.ParticipantUserId);

            _repository.Commit();
        }
Exemple #3
0
        public Result Handle(ReserveSeatCommand command)
        {
            var meetup = _repository.Load(command.MeetupId);

            var result = meetup.ReserveSeat(command.ParticipantUserId, DateTime.UtcNow);

            _repository.Commit();

            return(result);
        }