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()); }
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()); }
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()); }
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()); }
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()); }
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)); }
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()); }
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)); }
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()); }
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()); }
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)); }