public async Task DeleteAsync(Guid accommodationId)
        {
            var accommodation = await accommodationDataSource.FindAsync(accommodationId);

            if (accommodation == null)
            {
                throw new AccommodationNotFoundException(accommodationId);
            }

            await accommodationDataSource.DeleteAsync(accommodationId);

            await facilityService.DecrementAccommodationCountAsync(accommodation.FacilityId);

            await searchIndexer.DeleteAccommodationIndexAsync(accommodationId);
        }
Пример #2
0
 protected override Task Handle(RemoveAccommodationCommand request, CancellationToken cancellationToken)
 {
     return(searchIndexer.DeleteAccommodationIndexAsync(request.Id));
 }