public ActionResult ForeignKeyColumn_Create([DataSourceRequest] DataSourceRequest request, Order order)
        {
            order.OrderID = orderList[orderList.Count - 1].OrderID + 1;
                orderList.Add(order);

                return Json(new[] { order }.ToDataSourceResult(request, ModelState));
        }
        public ActionResult Update([DataSourceRequest] DataSourceRequest request, Order order)
        {
            if (order != null && ModelState.IsValid)
            {
                OrderRepository.Update(order);
            }

            return Json(ModelState.ToDataSourceResult());
        }
        public ActionResult ForeignKeyColumn_Delete([DataSourceRequest] DataSourceRequest request, Order order)
        {
            if (order != null && ModelState.IsValid)
            {
                var target = orderList.Where(o => o.OrderID == order.OrderID).FirstOrDefault();

                if (target != null)
                {
                    orderList.Remove(target);
                }

            }

            return Json(ModelState.ToDataSourceResult());
        }
        public ActionResult ForeignKeyColumn_Update([DataSourceRequest] DataSourceRequest request, Order order)
        {
            if (order != null && ModelState.IsValid)
            {

                var target = orderList.Where(o => o.OrderID == order.OrderID).FirstOrDefault();

                if (target != null)
                {
                    int targetIndex = orderList.IndexOf(target);
                    orderList[targetIndex].OrderDate = order.OrderDate;
                    orderList[targetIndex].EmployeeId = order.EmployeeId;
                    orderList[targetIndex].OrderDescription = order.OrderDescription;
                }
            }

            return Json(ModelState.ToDataSourceResult());
        }
 public ActionResult Create([DataSourceRequest] DataSourceRequest request, Order order)
 {
     OrderRepository.Insert(order);
     return Json(new[] { order }.ToDataSourceResult(request, ModelState));
 }
 public static void Update(Order order)
 {
     Order target = One(o => o.OrderID == order.OrderID);
     if (target != null)
     {
         target.OrderID = order.OrderID;
         target.OrderDate = order.OrderDate;
         target.EmployeeID = order.EmployeeID;
         target.OrderDescription = order.OrderDescription;
         target.IsCompleted = order.IsCompleted;
         target.OrderTotal = order.OrderTotal;
     }
 }
 public static void Remove(Order order)
 {
     Order target = One(o => o.OrderID == order.OrderID);
     if (target != null)
     {
         GetAll().Remove(target);
     }
 }
        public static void Insert(Order order)
        {
            order.OrderID = GetAll().OrderByDescending(p => p.OrderID).First().OrderID + 1;

            GetAll().Insert(0, order);
        }