public JsonResult AutoCompleteMedicine(string prefix) { try { MedicationRepository objRepo = new MedicationRepository(); var medicine = objRepo.GetMedicines(prefix); return(Json(medicine, JsonRequestBehavior.AllowGet)); } catch (System.Web.Http.HttpResponseException ex) { return(Json(new { Message = ex.Response })); } //return Json(customers); }
public JsonResult GetMedicines(string prefix) { try { MedicationRepository objRepo = new MedicationRepository(); List <MedicineModel> model = objRepo.GetMedicines(prefix); return(Json(new { Success = true, Medicines = model })); } catch (Exception ex) { return(Json(new { Message = ex.Message })); } }