コード例 #1
0
        public async Task <IActionResult> Get(string path, CancellationToken token)
        {
            DocumentId      documentId = DocumentIdTools.FromUrlEncoding(path);
            BlockChainModel?model      = await _contractService.Get(documentId, token);

            return(model != null?Ok(model) : NotFound());
        }
コード例 #2
0
        public async Task <IActionResult> Delete(string path, CancellationToken token)
        {
            DocumentId documentId = DocumentIdTools.FromUrlEncoding(path);
            bool       status     = await _contractService.Delete(documentId, token : token);

            return(status ? Ok() : NotFound());
        }
コード例 #3
0
        public async Task <IActionResult> Validate(string path, CancellationToken token)
        {
            DocumentId documentId = DocumentIdTools.FromUrlEncoding(path);

            bool isValid = await _contractService.Validate(documentId, token);

            return(isValid ? Ok() : Conflict());
        }
コード例 #4
0
    public async Task <IActionResult> Delete(string path, CancellationToken token)
    {
        if (path.IsDocumentIdValid().Valid)
        {
            return(BadRequest());
        }
        DocumentId documentId = DocumentIdTools.FromUrlEncoding(path);

        bool status = await _identityService.Delete(documentId, token);

        return(status ? Ok() : NotFound());
    }
コード例 #5
0
ファイル: AccountController.cs プロジェクト: khooversoft/Spin
        public async Task <IActionResult> Delete(string path, CancellationToken token)
        {
            DocumentId documentId = DocumentIdTools.FromUrlEncoding(path);

            if (!documentId.Container.IsEmpty())
            {
                return(BadRequest(_noContainer));
            }

            bool response = await _service.Delete(documentId, token);

            return(response ? Ok(response) : NotFound());
        }
コード例 #6
0
    public async Task <IActionResult> Get(string path, CancellationToken token)
    {
        DocumentId documentId = DocumentIdTools.FromUrlEncoding(path);

        bool bypassCache = Request.Headers.ContainsKey(Constants.BypassCacheName);

        DirectoryEntry?entry = await _directoryService.Get(documentId, token, bypassCache : bypassCache);

        if (entry == null)
        {
            return(NotFound());
        }

        return(Ok(entry));
    }
コード例 #7
0
        public async Task <IActionResult> Delete(string path, CancellationToken token)
        {
            DocumentId documentId = DocumentIdTools.FromUrlEncoding(path);

            if (documentId.Container.IsEmpty() || !_documentPackageFactory.Exist(documentId.Container))
            {
                return(BadRequest(_containerErrorMsg));
            }

            bool status = await _documentPackageFactory
                          .Create(documentId.Container)
                          .Delete(documentId, token: token);

            return(status ? Ok() : NotFound());
        }
コード例 #8
0
        public async Task <IActionResult> Get(string path, CancellationToken token)
        {
            DocumentId documentId = DocumentIdTools.FromUrlEncoding(path);

            if (documentId.Container.IsEmpty() || !_documentPackageFactory.Exist(documentId.Container))
            {
                return(BadRequest(_containerErrorMsg));
            }

            Document?document = await _documentPackageFactory
                                .Create(documentId.Container)
                                .Get(documentId, token);

            return(document == null?NotFound() : Ok(document));
        }
コード例 #9
0
        public async Task <IActionResult> Set(string path, [FromBody] BlockChainModel blockChainModel, CancellationToken token)
        {
            blockChainModel.Verify();
            DocumentId documentId = DocumentIdTools.FromUrlEncoding(path);

            bool isValid = await _contractService.Validate(blockChainModel.ToBlockChain(), token);

            if (!isValid)
            {
                return(Conflict());
            }

            await _contractService.Set(documentId, blockChainModel, token);

            return(Ok());
        }
コード例 #10
0
        public async Task <IActionResult> Sign(string path, [FromBody] BlockChainModel blockChainModel, CancellationToken token)
        {
            blockChainModel.Verify();

            BlockChain blockChain = await _contractService.Sign(blockChainModel.ToBlockChain(), token);

            if (path == "model")
            {
                return(Ok(blockChain.ToBlockChainModel()));
            }

            DocumentId documentId = DocumentIdTools.FromUrlEncoding(path);
            await _contractService.Set(documentId, blockChain.ToBlockChainModel(), token);

            return(Ok());
        }
コード例 #11
0
ファイル: AccountController.cs プロジェクト: khooversoft/Spin
        public async Task <IActionResult> Get(string path, CancellationToken token)
        {
            DocumentId documentId = DocumentIdTools.FromUrlEncoding(path);

            if (!documentId.Container.IsEmpty())
            {
                return(BadRequest(_noContainer));
            }

            BankAccount?response = await _service.Get(documentId, token);

            if (response == null)
            {
                return(NotFound());
            }

            return(Ok(response));
        }