コード例 #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 Update(ScheduleCreateCommand command)
        {
            CompetitionId = command.CompetitionId;
            Days = command
                        .Days
                        .Select(x => new ScheduleDay(x.AddHours(14))) //start at 8 am - HACK: add an additional 6 hours for UTC - total, ugly hack
                        .ToList();

            this.RegisterCommand(command);
        }