コード例 #1
0
        public JsonDotNetResult Create(CompetitionCreateCommand command)
        {
            return ExecuteInExplicitTransaction(
                action: () =>
                {
                    var competition = new Competition();
                    competition.Update(command);
                    RavenSession.Store(competition);
                    RavenSession.SaveChanges();

                    var scheduleCreateCommand = new ScheduleCreateCommand
                                                {
                                                    CompetitionId = competition.Id,
                                                    Days = competition.Days
                                                };

                    scheduleCreateCommand.CopyCommandPropertiesFrom(command);

                    var schedule = new Schedule();
                    schedule.Update(scheduleCreateCommand);
                    RavenSession.Store(schedule);
                    RavenSession.SaveChanges();

                    var url = Url.Action("Details", "Competition", new {id = competition.Id.ForMvc()});
                    return new JsonDotNetResult(url);
                });
        }
コード例 #2
0
 public void GivenACompetitionCreateCommand()
 {
     _command = new CompetitionCreateCommand {CommandByUser = "******", CommandWhen = DateTime.UtcNow};
 }