public JsonResult GetCustomerDetails(string prefix) { dynamic customers = 0; try { if (ModelState.IsValid) { SaleServiceClient service = new SaleServiceClient(); customers = service.GetCustomerDetails(prefix); //return Json(customers, JsonRequestBehavior.AllowGet); } } catch (Exception ex) { ModelState.AddModelError("error", "Something Went Wrong"); customers = null; throw ex; } return(Json(customers, JsonRequestBehavior.AllowGet)); }