vendredi 4 décembre 2015

edit multiple rows in a table using linq mvc

I have table like below

enter image description here

Once I pass Product_ID as "01" I want to expand all relevant rows into editor view and once I submit those save those values into this table.

So I create my get method like this

    public ActionResult Product_Edit(string Product_ID)
        Product_ID = "01";

        var product_fields = (from productstatistics in db.AB_Product_vs_Field
                              where productstatistics.Product_ID == Product_ID
                              select new AB_Product_vs_Field
                                Product_ID = productstatistics.Product_ID,
                                Field_ID = productstatistics.Field_ID,
                                Field_Value_EN = productstatistics.Field_Value_EN,
                                Field_Value_AR = productstatistics.Field_Value_AR

        if (product_fields == null)
            return HttpNotFound();

        return View(product_fields);


but here I'm getting following exception message

The entity or complex type 'project_name.table_name' cannot be constructed in a LINQ to Entities query.

Aucun commentaire:

Enregistrer un commentaire