public async Task <IActionResult> GetProductById(int?postId) { if (postId == null) { _logger.LogInformation("No data "); return(BadRequest()); } try { var post = await _ProductRepositories1.GetProductById(postId); if (post == null) { return(NotFound()); } return(Ok(post)); } catch (Exception ex) { _logger.LogInformation(ex.Message); return(BadRequest()); } }