//For Create Cause on Claim Module public JsonResult Search3(string term) { try { term = term.Trim(); var items = CauseManager.GetAll(); if (!string.IsNullOrEmpty(term)) { items = CauseManager.GetBySearch(term); } return(Json(items.Select(m => new { label = String.Format("[{0}] {1}", m.sCode, m.sDescription), description = m.sDescription, price = m.dPrice }) , JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { Result = "ERROR", Message = ex.Message })); } }
public JsonResult Search(string q) { try { q = q.Trim(); var items = CauseManager.GetAll(); if (!string.IsNullOrEmpty(q)) { items = CauseManager.GetBySearch(q); } return(Json(items.Select(m => new { name = String.Format("[{0}] {1} ราคา {2} บาท", m.sCode, m.sDescription, m.dPrice), id = m.sDescription, Readonly = "true" }) , JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { Result = "ERROR", Message = ex.Message })); } }