예제 #1
0
 public Block GetBlock(int id)
 {
     try
     {
         return(_blockService.GetBlock(id));
     }
     catch (ArgumentOutOfRangeException)
     {
         HttpContext.Response.StatusCode = StatusCodes.Status404NotFound;
         return(null);
     }
 }
 public IActionResult GetBlock(string blockIndex)
 {
     _logger.LogDebug("[GET] block/{}", blockIndex);
     try
     {
         var block = _blockService.GetBlock(blockIndex);
         return(Ok(block.BlockHeader));
     }
     catch (BlockNotFoundException)
     {
         return(NotFound());
     }
     catch (ReadingBlockException ex)
     {
         var msg = String.Format("Exception was thrown while getting the block with index '{0}'.", blockIndex);
         _logger.LogWarning(msg, ex);
         return(NotFound());
     }
 }
예제 #3
0
 //public async Task<ActionResult<BlockItem>> GetBlockItem(long id)
 public BlockItem GetBlockItem(int id)
 {
     return(_service.GetBlock(id));
 }