This is a migrated thread and some comments may be shown as answers.

Facing this issue IN KENDO UI MVC GRID EDIT UPDATE DELETE AND CREATE USER and The Database Table values is Changed

2 Answers 49 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Moinul Haque
Top achievements
Rank 1
Moinul Haque asked on 21 Feb 2014, 11:12 AM
 public ActionResult Products_Create([DataSourceRequest]DataSourceRequest request, Customer_ product)
        {
            if (ModelState.IsValid)
            {
                using (var northwind = new StreeboRevForecastModel_Entities())
                {
                    var entity = new Customer_
                    {
                        Customer_ID = product.Customer_ID,
                        Customer_Name = product.Customer_Name,
                        Costomer_Country = product.Costomer_Country,
                        Customer_State = product.Customer_State,
                        Customer_Status = product.Customer_Status,
                        Owner = product.Owner
                    };
                    northwind.Customer_.Add(entity);
                    northwind.SaveChanges();
                    product.Customer_ID = entity.Customer_ID;
                }
            }
            return Json(new[] { product }.ToDataSourceResult(request, ModelState));
        }

        public ActionResult Products_Update([DataSourceRequest]DataSourceRequest request, Customer_ product)
        {
            if (ModelState.IsValid)
            {
                using (var northwind = new StreeboRevForecastModel_Entities())
                {
                    var entity = new Customer_
                    {
                        Customer_ID = product.Customer_ID,
                        Customer_Name = product.Customer_Name,
                        Costomer_Country = product.Costomer_Country,
                        Customer_State = product.Customer_State,
                        Customer_Status = product.Customer_Status,
                        Owner = product.Owner
                    };                 
                    northwind.Customer_.Attach(entity);                    
                    northwind.Entry(entity).State = EntityState.Modified;
                    northwind.SaveChanges();
                }
            }
            return Json(new[] { product }.ToDataSourceResult(request, ModelState));
        }

        public ActionResult Products_Destroy([DataSourceRequest]DataSourceRequest request, Customer_ product)
        {
            if (ModelState.IsValid)
            {
                using (var northwind = new StreeboRevForecastModel_Entities())
                {
                    var entity = new Customer_
                    {
                        Customer_ID = product.Customer_ID,
                        Customer_Name = product.Customer_Name,
                        Costomer_Country = product.Costomer_Country,
                        Customer_State = product.Customer_State,
                        Customer_Status = product.Customer_Status,
                        Owner = product.Owner
                    };
                    northwind.Customer_.Attach(entity);
                    northwind.Customer_.Remove(entity);
                   northwind.SaveChanges();
                }
            }
           return Json(new[] { product }.ToDataSourceResult(request, ModelState));
        }

2 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 25 Feb 2014, 09:08 AM
Hi,

From the provided information it's not clear for us what is the exact reason for current behavior - could you please provide runable project where the issue is reproduced? This would help us pinpoint the exact reason for this behavior.

Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
rajnikant
Top achievements
Rank 1
answered on 25 Sep 2014, 10:39 AM
hii,,
Moinul Haque

i am facing this error right now,,,

if u find any solution then plz tell me the way,,,,

Tags
Grid
Asked by
Moinul Haque
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
rajnikant
Top achievements
Rank 1
Share this question
or