コード例 #1
0
        public IEnumerable Handle(Func <Guid, ParticipantAggregate> al, ReplaceParticipant command)
        {
            var agg       = al(command.Id);
            var alternate = CommandQueries.GetParticipant(command.AlternateId);

            yield return(new ParticipantReplacedWithAlternate
            {
                Id = command.Id,
                ContingentId = alternate.ContingentId,
                TeamId = alternate.TeamId,
                Name = agg.Name,
                AlternateId = command.AlternateId,
                AlternateName = alternate.Name,
                Average = alternate.Average,
            });
        }
コード例 #2
0
        public JsonResult UseAlternate(ReplaceParticipant command)
        {
            //Replace the participant
            Domain.Dispatcher.SendCommand(command);

            //Add the alternate to the team
            var participant = Domain.ParticipantQueries.GetParticipant(command.Id);

            Domain.Dispatcher.SendCommand(
                new AddParticipantToTeam {
                Id     = command.AlternateId,
                TeamId = participant.TeamId
            });

            var alternate = Domain.ParticipantQueries.GetParticipant(command.AlternateId);

            return(Json(alternate));
        }