public ActionResult OrdersGridViewPartialUpdate(AdvancedMasterDetail.Models.Order_Detail item, int key)
        {
            var model = context.Order_Details;

            ViewData["orderKey"] = key;
            if (ModelState.IsValid)
            {
                try
                {
                    var modelItem = model.FirstOrDefault(it => it.OrderID == item.OrderID);
                    if (modelItem != null)
                    {
                        this.UpdateModel(modelItem);
                        context.SubmitChanges();
                    }
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }

            var querymodel = context.Order_Details.Where(order => order.ProductID == key);

            return(PartialView("_OrdersGridViewPartial", querymodel));
        }
        public ActionResult OrdersGridViewPartialAddNew(AdvancedMasterDetail.Models.Order_Detail item, int key)
        {
            var model = context.Order_Details;

            ViewData["orderKey"] = key;
            if (ModelState.IsValid)
            {
                try
                {
                    item.ProductID = key;
                    item.Product   = context.Products.Where(productItem => productItem.ProductID == key).FirstOrDefault();
                    model.InsertOnSubmit(item);
                    context.SubmitChanges();
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }
            var querymodel = context.Order_Details.Where(order => order.ProductID == key);

            return(PartialView("_OrdersGridViewPartial", querymodel));
        }