Beispiel #1
0
        public async Task <SCIMRepresentation> Handle(DeleteRepresentationCommand request)
        {
            var representation = await _scimRepresentationQueryRepository.FindSCIMRepresentationById(request.Id, request.ResourceType);

            if (representation == null)
            {
                throw new SCIMNotFoundException(string.Format(Global.ResourceNotFound, request.Id));
            }

            var references = await _representationReferenceSync.Sync(request.ResourceType, representation, representation, request.Location, true, true);

            using (var transaction = await _scimRepresentationCommandRepository.StartTransaction())
            {
                await _scimRepresentationCommandRepository.Delete(representation);

                foreach (var reference in references.Representations)
                {
                    await _scimRepresentationCommandRepository.Update(reference);
                }

                await transaction.Commit();
            }

            await Notify(references);

            return(representation);
        }
        public async Task <bool> Handle(DeleteRepresentationCommand request)
        {
            var representation = await _scimRepresentationQueryRepository.FindSCIMRepresentationById(request.Id, request.ResourceType);

            if (representation == null)
            {
                throw new SCIMNotFoundException(null, null);
            }

            _scimRepresentationCommandRepository.Delete(representation);
            await _scimRepresentationCommandRepository.SaveChanges();

            return(true);
        }
        public async Task <bool> Handle(DeleteRepresentationCommand request)
        {
            var representation = await _scimRepresentationQueryRepository.FindSCIMRepresentationById(request.Id, request.ResourceType);

            if (representation == null)
            {
                throw new SCIMNotFoundException(string.Format(Global.ResourceNotFound, request.Id));
            }

            using (var transaction = await _scimRepresentationCommandRepository.StartTransaction())
            {
                await _scimRepresentationCommandRepository.Delete(representation);

                await transaction.Commit();
            }

            return(true);
        }