Home ยป How to use LINQ to SQL and DevExpress grid by implementing Extensibility Method Definitions?

How to use LINQ to SQL and DevExpress grid by implementing Extensibility Method Definitions?

[HttpPost]
    public ActionResult ProductGridPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] Product prod)
    {
        var EditProd = db.Products.Single(p => p.Id == prod.Id);
        if (EditProd != null)
        {
            EditProd.ProductCode = prod.ProductCode;
            EditProd.ProductTitle = prod.ProductTitle;
            EditProd.BinNo = prod.BinNo;
            db.SubmitChanges();
        }

        var q = from p in db.Products select p;
        return PartialView(“ProductGridPartial”, q);
    }

[HttpPost]
    public ActionResult ProductGridPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] Product prod)
    {
        db.UpdateProduct(prod);

        var q = from p in db.Products select p;
        return PartialView(“ProductGridPartial”, q);
    }

[HttpPost]
    public ActionResult ProductGridPartialUpdate([ModelBinder(typeof(DevExpressEditorsBinder))] Product prod)
    {
        db.SubmitChanges();

        var q = from p in db.Products select p;
        return PartialView(“ProductGridPartial”, q);
    }

#region Extensibility Method Definitions
partial void OnCreated();
partial void InsertProduct(Product instance);
partial void UpdateProduct(Product instance);
partial void DeleteProduct(Product instance);
#endregion

namespace TradeMeStore.Models
{
    partial class TradeMeStoreDataContext
    {
        partial void UpdateProduct(Product instance)
        {
            ExecuteDynamicUpdate(instance);
        }
    }
}

1 Comment

Click here to post a comment

Your email address will not be published. Required fields are marked *