public JsonResult GetAdvocateGroupForDropDown(string searchKey) { var getData = db.GetAllAdvocateGroups().ToList(); if (searchKey != null) { getData = db.GetAllAdvocateGroups().Where(x => x.GroupName.Contains(searchKey)).ToList(); } var ModifiedData = getData.Select(x => new { id = x.Id, text = x.GroupName }); return(Json(ModifiedData, JsonRequestBehavior.AllowGet)); }