public string GetJson <TModel>(SearchOptions <TModel> searchOptions, string htmlData, string htmlContainerName) { var searchOptionsSD = searchOptions.GetSDObject(); searchOptionsSD.HtmlContainerName = htmlContainerName; searchOptionsSD.HtmlData = htmlData; return(_jsonSerializer.Serialize(searchOptionsSD)); }
public static MvcHtmlString FacetedSearchJsInit <TModel>(this HtmlHelper <TModel> htmlHelper, string elementSelector, SearchOptions searchOptions, object options = null) { if (searchOptions == null) { return(MvcHtmlString.Empty); } var opt = options != null ? new FacetedOptions(options) : new FacetedOptions(); opt.searchOptions = searchOptions.GetSDObject(); string json = new DefaultJsonSerializer().Serialize(opt); return(MvcHtmlString.Create( string.Format("$(\"{0}\").facetedsearch({1});", elementSelector, json))); }