示例#1
0
 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"));
     }
 }
示例#2
0
        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));
            }
        }
示例#3
0
        public IActionResult EditDrug(int Id)
        {
            var drug = _drugService.GetDrugById(Id);

            return(View(drug));
        }