public ActionResult SearchResult(string searchString, string searchType) { List <User> users = null; if (searchString == "") { return(Json(string.Empty, JsonRequestBehavior.AllowGet)); } if (searchType.Equals("name")) { string[] names = searchString.Split(); if (names.Length > 1) { users = _dal.TrainerProfileSearchFullName(names[0], names[1]); } else if (names.Length == 1) { users = _dal.TrainerProfileSearchPartialName(names[0]); } } else if (searchType.Equals("price")) { int price = Convert.ToInt32(searchString); users = _dal.TrainerProfileSearchPrice(price); } else if (searchType.Equals("location")) { int location = Convert.ToInt32(searchString); users = _dal.TrainerProfileSearchLocation(location); } return(Json(users, JsonRequestBehavior.AllowGet)); }