public JsonResult Autocomplete(string type, string term) { object result; if (type == "user") { result = uf.Autocomplete(term); } else // book { result = bf.Autocomplete(term); } return(Json(result, JsonRequestBehavior.AllowGet)); }