/// <summary> /// Get json format string of ListVM's search result /// </summary> /// <typeparam name="T">Model type</typeparam> /// <param name="self">a listvm</param> /// <param name="PlainText">true to return plain text, false to return formated html, such as checkbox,buttons ...</param> /// <returns>json string</returns> public static string GetJson <T>(this IBasePagedListVM <T, BaseSearcher> self, bool PlainText = true) where T : TopBasePoco, new() { Hashtable ht = new Hashtable { ["Data"] = self.GetDataJson(), ["Count"] = self.Searcher.Count, ["Page"] = self.Searcher.Page, ["PageCount"] = self.Searcher.PageCount, ["Msg"] = "success", ["Code"] = "200" }; return(JsonSerializer.Serialize(ht)); }
/// <summary> /// Get json format string of ListVM's search result /// </summary> /// <typeparam name="T">Model type</typeparam> /// <param name="self">a listvm</param> /// <param name="PlainText">true to return plain text, false to return formated html, such as checkbox,buttons ...</param> /// <returns>json string</returns> public static string GetJson <T>(this IBasePagedListVM <T, BaseSearcher> self, bool PlainText = true) where T : TopBasePoco, new() { return($@"{{""Data"":{self.GetDataJson(PlainText)},""Count"":{self.Searcher.Count},""Page"":{self.Searcher.Page},""PageCount"":{self.Searcher.PageCount},""Msg"":""success"",""Code"":200}}"); }
public static string GetJson <T>(this IBasePagedListVM <T, BaseSearcher> self) where T : TopBasePoco, new() { return($@"{{""Data"":{self.GetDataJson(true)},""Count"":{self.Searcher.Count},""Page"":{self.Searcher.Page},""PageCount"":{self.Searcher.PageCount}}}"); }