예제 #1
0
        /// <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));
        }
예제 #2
0
 /// <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}}");
 }
예제 #3
0
파일: ListVMExtension.cs 프로젝트: zzti/WTM
 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}}}");
 }