public IActionResult SearchDrugsByID(int drugId) { try { // validating drugId if (drugId > 0) { // Checking if drug with specific id is present. Drug drug = _drugService.SearchDrugsByID(drugId); // Drug ID(id) entered For Searching. if (drug == null) { return(NotFound("Drug with specified drugId is not available")); } return(Ok(drug)); } return(BadRequest()); } catch (Exception e) { return(BadRequest("Error occured from " + nameof(DrugsApiController.SearchDrugsByID) + " Error Message " + e.Message)); } }