public HttpResponseMessage GetJson(string order,string sort) { AccorOTADBEntities db = new AccorOTADBEntities(); var list = db.OTA_RoomPriceDataCache.ToList(); BootstrapTableEntity<OTA_RoomPriceDataCache> bList = new BootstrapTableEntity<OTA_RoomPriceDataCache>(); bList.total = list.Count; bList.rows = list; string json = JsonConvert.SerializeObject(bList, Formatting.Indented); db.Dispose(); return new HttpResponseMessage { Content = new StringContent(json, System.Text.Encoding.UTF8, "application/json") }; }
public JsonResult GetJson(string search, string sort, string order, int limit = 0, int offset = 0) { AccorOTADBEntities db = new AccorOTADBEntities(); var list = db.OTA_RoomPriceDataCache.ToList(); BootstrapTableEntity<OTA_RoomPriceDataCache> bList = new BootstrapTableEntity<OTA_RoomPriceDataCache>(); bList.total = list.Count; bList.rows = list; var jsonResult = new JsonNetResult(); jsonResult.Data = bList; jsonResult.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return jsonResult; }