public async Task <CreateTimeslotResponse> Handle(CreateTimeslotCommand request, CancellationToken cancellationToken)
        {
            var teacher = await _tpp.GetTeacherWithTimeslotsById(request.TeacherId);

            var calendar = await _cpp.GetByIdAsync(request.CalendarId);

            var timeslot = new Timeslot(request.StartTime, request.EndTime, teacher, calendar);

            teacher.AddTimeslot(timeslot);
            await _tpp.Update(teacher);

            return(new CreateTimeslotResponse {
                Id = timeslot.Id
            });
        }
Ejemplo n.º 2
0
 public async Task <Domain.Calendar> Handle(GetCalendarQuery request, CancellationToken cancellationToken)
 {
     return(await _cpp.GetByIdAsync(request.Id));
 }