public OneOf <NotFound, Success> Execute(InMemoryDocumentStore inMemoryDocumentStore, DeleteVenue request)
        {
            var venue = inMemoryDocumentStore.Venues.All.FirstOrDefault(v => v.Id == request.VenueId);

            if (venue == null)
            {
                return(new NotFound());
            }

            venue.Status      = VenueStatus.Archived;
            venue.DateUpdated = request.UpdatedDate;
            venue.UpdatedBy   = request.UpdatedBy.UserId;

            inMemoryDocumentStore.Venues.Save(venue);

            return(new Success());
        }
        public async Task <OneOf <NotFound, Success> > Execute(DocumentClient client, Configuration configuration, DeleteVenue request)
        {
            var documentUri = UriFactory.CreateDocumentUri(
                configuration.DatabaseId,
                configuration.VenuesCollectionName,
                request.VenueId.ToString());

            Venue venue;

            try
            {
                var query = await client.ReadDocumentAsync <Venue>(documentUri);

                venue = query.Document;

                venue.Status      = VenueStatus.Archived;
                venue.DateUpdated = request.UpdatedDate;
                venue.UpdatedBy   = request.UpdatedBy.UserId;

                await client.ReplaceDocumentAsync(documentUri, venue);
            }
            catch (DocumentClientException ex)
                when(ex.StatusCode == HttpStatusCode.NotFound)
                {
                    return(new NotFound());
                }

            await _sqlDataSync.SyncVenue(venue);

            return(new Success());
        }
        public async Task <OneOf <NotFound, Success> > Execute(SqlTransaction transaction, DeleteVenue query)
        {
            var sql = $@"
UPDATE Pttcd.Venues SET
    VenueStatus = {(int)VenueStatus.Archived},
    UpdatedOn = @DeletedOn,
    UpdatedBy = @DeletedByUserId
WHERE VenueId = @VenueId
AND VenueStatus <> {(int)VenueStatus.Archived}";

            var paramz = new
            {
                query.VenueId,
                query.DeletedOn,
                DeletedByUserId = query.DeletedBy.UserId
            };

            var deleted = (await transaction.Connection.ExecuteAsync(sql, paramz, transaction)) == 1;

            if (deleted)
            {
                return(new Success());
            }
            else
            {
                return(new NotFound());
            }
        }