Exemplo n.º 1
0
        public async Task HandleAsync(CreateScheduleSchema command)
        {
            var alreadyExists = await _repository.ExistsAsync(command.CinemaId);

            if (alreadyExists)
            {
                throw new ScheduleSchemaAlreadyExistsException(command.CinemaId);
            }

            var scheduleSchema = ScheduleSchema.Create(command.Id, command.CinemaId, command.Times.AsScheduleSchemaTimes());
            await _repository.AddAsync(scheduleSchema);

            await _processor.ProcessAsync(scheduleSchema.DomainEvents);
        }
Exemplo n.º 2
0
 public static ScheduleSchemaDocument AsDocument(this ScheduleSchema schema)
 => new ScheduleSchemaDocument
 {
     Id       = schema.Id,
     CinemaId = schema.CinemaId,
     Times    = schema.Times?.Select(st => new ScheduleSchemaTimesDocument
     {
         AgeRestriction = st.ageRestriction,
         Times          = st.times?.Select(t => new TimeDocument
         {
             Hour   = t.Hour,
             Minute = t.Minute
         })
     }),
     Version = schema.Version
 };
Exemplo n.º 3
0
 public ScheduleSchemaAdded(ScheduleSchema schema)
 {
     Schema = schema;
 }
Exemplo n.º 4
0
 public ScheduleSchemaTimesChanged(ScheduleSchema schema, ScheduleSchemaTimes times)
 {
     Schema = schema;
     Times  = times;
 }