/* * public void LoadObjectsJson(string filepath, Action< JsonListResponse<T> > onLoaded) * { * string content = File.ReadAllText(filepath); * JsonListResponse<T> vJson = JsonConvert.DeserializeObject< JsonListResponse<T> >(content); * * onLoaded(vJson); * } */ public T[] LoadObjectsJson(string filepath) { string content = File.ReadAllText(filepath); JsonListResponse <T> vJson = JsonConvert.DeserializeObject <JsonListResponse <T> >(content); return(vJson.response); }
protected HttpResponseMessage toListJson <T>(PageList <T> list, OperatingState opstate, string message) { JsonListResponse response = new JsonListResponse { Message = message, State = opstate, PageIndex = list.PageIndex, PageSize = list.PageSize, TotalCount = list.TotalCount, TotalPages = list.TotalPages, DataModel = list.Data }; return(toJsonbase(response)); }
protected HttpResponseMessage toListJson <T>(PageList <T> list) { JsonListResponse response = new JsonListResponse { Message = "", State = OperatingState.Success, PageIndex = list.PageIndex, PageSize = list.PageSize, TotalCount = list.TotalCount, TotalPages = list.TotalPages, DataModel = list.Data }; return(toJsonbase(response)); }