public IActionResult Get(int id) { CategoryDetailBO categoryDetailBO; CategoryDetail categoryDetail; ObjectResult response; try { _log.LogInformation($"Starting Get( {id} )"); categoryDetailBO = new CategoryDetailBO(_loggerFactory, _config); categoryDetail = categoryDetailBO.Get(id); if (categoryDetail != null) { response = Ok(categoryDetail); } else { response = NotFound(string.Empty); } _log.LogInformation($"Finishing Get( {id} )"); } catch (Exception ex) { _log.LogError(ex.Message); response = StatusCode(500, ex.Message); } return(response); }
public IActionResult Get(int?categoryID = null) { CategoryDetailBO categoryDetailBO; List <CategoryDetail> categoryDetails; ObjectResult response; try { _log.LogInformation("Starting Get()"); categoryDetailBO = new CategoryDetailBO(_loggerFactory, _config); categoryDetails = categoryDetailBO.Get(categoryID); response = Ok(categoryDetails); _log.LogInformation($"Finishing Get() with '{categoryDetails.Count}' results"); } catch (Exception ex) { _log.LogError(ex.Message); response = StatusCode(500, ex.Message); } return(response); }