public async Task <ServiceItemViewModel> AddServiceItem(ServiceItemViewModel serviceItem) { var domainservice = new SchedulableCatalogItem( serviceItem.SiteId, serviceItem.Name, serviceItem.Description, serviceItem.DefaultTimeLength, serviceItem.Price, serviceItem.ServiceCategoryId, serviceItem.IndustryStandardCategoryId ); _serviceItemRepository.Add(domainservice); var serviceItemCreatedEvent = new ServiceItemCreatedEvent( domainservice.SiteId, domainservice.Id, domainservice.Name, domainservice.Description, domainservice.DefaultTimeLength, domainservice.Price, domainservice.AllowOnlineScheduling, domainservice.ServiceCategoryId, domainservice.IndustryStandardCategoryId ); await _businessIntegrationEventService.PublishThroughEventBusAsync(serviceItemCreatedEvent); //_session.Add<ServiceItem>(domainservice); //_session.Commit(); serviceItem.Id = domainservice.Id; return(serviceItem); }
public async Task <Unavailability> AddUnavailability(AddUnavailabilityCommand addUnavailabilityCommand) { SchedulableCatalogItem serviceItem = GetExistingServiceItem(addUnavailabilityCommand.SiteId, addUnavailabilityCommand.ServiceItemId); Unavailability unavailability = serviceItem.AddUnavailability( addUnavailabilityCommand.StaffId, addUnavailabilityCommand.LocationId, addUnavailabilityCommand.StartDateTime, addUnavailabilityCommand.EndDateTime, addUnavailabilityCommand.Sunday, addUnavailabilityCommand.Monday, addUnavailabilityCommand.Tuesday, addUnavailabilityCommand.Wednesday, addUnavailabilityCommand.Thursday, addUnavailabilityCommand.Friday, addUnavailabilityCommand.Saturday, addUnavailabilityCommand.Description); await _businessIntegrationEventService.PublishThroughEventBusAsync(new UnavailabilityCreatedEvent( 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 )); return(unavailability); }