Hi, I m fetching the problem with updating record, when I debug my project then it made those changes in data, but its not saving the updated record and showing an error on db.SaveChanges();
The error is ; Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh ObjectStateManager entries.
[NonAction] privateFinancilInstituteWrappergetData(int id) { FinancilInstituteWrapper temp = newFinancilInstituteWrapper(); var details = from i indb.IIDBS join a indb.ACDBS oni.Idequalsa.Id join b indb.BIDBSoni.Idequalsb.Id wherei.Id==id selectnewFinancilInstituteWrapper { II = i, AC = a, BI = b }; foreach (FinancilInstituteWrapper a in details) { temp.II = a.II; temp.BI = a.BI; temp.AC = a.AC; } return temp; } // // GET: /FinancilInstitute/Edit/5 publicActionResult Edit(int id=0) { return View(getData(id)); } // // POST: /FinancilInstitute/Edit/5 [HttpPost] publicActionResult Edit(FinancilInstituteWrapper wrapper) { // try // { if (ModelState.IsValid) { db.Entry(wrapper.II).State = EntityState.Modified; db.Entry(wrapper.AC).State = EntityState.Modified; db.Entry(wrapper.BI).State = EntityState.Modified; try { db.SaveChanges(); } catch (OptimisticConcurrencyException) { } returnRedirectToAction("Index"); } // } //catch //{ return View(wrapper); //} }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)