public ActionResult <Drug> GetDrugById(int id) { _log4net.Info("DrugMicroService : " + nameof(GetDrugById)); if (id <= 0) { return(BadRequest("Please give valid id")); } try { var Drug = _drugService.GetDrugById(id); if (Drug == null) { return(BadRequest("data not found")); } else { return(Ok(Drug)); } } catch (Exception e) { _log4net.Error("Exception Occured : " + e.Message + " from " + nameof(GetDrugById)); return(BadRequest("Exception Occured")); } }
public ActionResult <Drug> Get(int id) { if (id == 0) { return(BadRequest("Please give valid id")); } var Drug = _drugService.GetDrugById(id); if (Drug == null) { return(BadRequest("data not found")); } else { return(Ok(Drug)); } }
public IActionResult EditDrug(int Id) { var drug = _drugService.GetDrugById(Id); return(View(drug)); }