Exemplo n.º 1
0
        //get filter data from jquery
        public JsonResult GetTblOrderWithParameter(string prefix)
        {
            List <tblOrder> allOrder = new List <tblOrder>();

            //Here MyOrderModel is DB context, which is created at the time of model creation
            using (Models.OrderModels.MyOrderModel db = new Models.OrderModels.MyOrderModel())
            {
                allOrder = db.tblOrder.Where(a => a.OrderTrackingNumber.Contains(prefix)).ToList();
            }
            return(new JsonResult {
                Data = allOrder, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Exemplo n.º 2
0
        //get ALL order data
        public JsonResult GetTblOrder()
        {
            List <tblOrder> allOrder = new List <tblOrder>();

            //Here MyOrderModel is DB context, which is created at the time of model creation
            using (Models.OrderModels.MyOrderModel db = new Models.OrderModels.MyOrderModel()) {
                //select data from MyOrderModel
                allOrder = db.tblOrder.ToList();
            }
            return(new JsonResult {
                Data = allOrder, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }