コード例 #1
0
 public IActionResult GetRecord(long id)
 {
     _logger.LogInformation($"{nameof(RecordController)} : {nameof(GetRecord)} was called.");
     try
     {
         var record = _recordService.FindById(id);
         if (record == null)
         {
             return(NotFound("Record Not Found"));
         }
         return(Ok(record));
     }
     catch (DbException exception)
     {
         _logger.LogError(exception.Message);
         return(BadRequest(exception.Message));
     }
     catch (Exception exception)
     {
         _logger.LogError(exception.Message);
         throw;
     }
 }
コード例 #2
0
 public async Task <RecordDTO> Get(int id)
 {
     return(await _recordService.FindById(id));
 }