Exemple #1
0
        public async Task <Unavailability> AddUnavailability(AddUnavailabilityCommand addUnavailabilityCommand)
        {
            Unavailability unavailability = new Unavailability(
                addUnavailabilityCommand.SiteId,
                addUnavailabilityCommand.StaffId,
                addUnavailabilityCommand.ServiceItemId,
                addUnavailabilityCommand.LocationId,
                addUnavailabilityCommand.StartDateTime,
                addUnavailabilityCommand.EndDateTime,
                addUnavailabilityCommand.Sunday,
                addUnavailabilityCommand.Monday,
                addUnavailabilityCommand.Tuesday,
                addUnavailabilityCommand.Wednesday,
                addUnavailabilityCommand.Thursday,
                addUnavailabilityCommand.Friday,
                addUnavailabilityCommand.Saturday,
                addUnavailabilityCommand.Description);

            _unavailabilityRepository.Add(unavailability);

            await _businessIntegrationEventService.PublishThroughEventBusAsync(new UnavailabilityAddedByStaffEvent(
                                                                                   unavailability.StaffId,
                                                                                   unavailability.SiteId,
                                                                                   unavailability.StaffId,
                                                                                   unavailability.ServiceItemId,
                                                                                   unavailability.LocationId,
                                                                                   unavailability.StartDateTime,
                                                                                   unavailability.EndDateTime,
                                                                                   unavailability.Sunday,
                                                                                   unavailability.Monday,
                                                                                   unavailability.Tuesday,
                                                                                   unavailability.Wednesday,
                                                                                   unavailability.Thursday,
                                                                                   unavailability.Friday,
                                                                                   unavailability.Saturday,
                                                                                   unavailability.Description
                                                                                   ));

            //_unavailabilityRepository.UnitOfWork.Commit();

            return(unavailability);
        }
Exemple #2
0
        public Task Handle(UnavailabilityCreatedEvent message)
        {
            Unavailability unavailability = new Unavailability(
                message.Id,
                message.SiteId,
                message.StaffId,
                message.ServiceItemId,
                message.LocationId,
                message.StartDateTime,
                message.EndDateTime,
                message.Sunday,
                message.Monday,
                message.Tuesday,
                message.Wednesday,
                message.Thursday,
                message.Friday,
                message.Saturday,
                message.Description);

            _unavailabilityRepository.Add(unavailability);
            _unavailabilityRepository.SaveChanges();
            return(Task.CompletedTask);
        }