public void Update(T item, Func <T, bool> findByIDPredecate) { var local = Context.Set <T>().Local.FirstOrDefault(findByIDPredecate); if (local != null) { Context.Entry(local).State = EntityState.Detached; } Context.Entry(item).State = EntityState.Modified; // Context.Entry(category).State = EntityState.Modified; //var entry = Context.Entry(category); //Context.Categories.Attach(category); //entry.State = EntityState.Modified; Context.SaveChanges(); }
public ActionResult Edit([Bind(Include = "Id,City,StreetName,WorkTime,OnlineOrder")] Shop shop) { if (ModelState.IsValid) { db.Entry(shop).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(shop)); }
public ActionResult Edit([Bind(Include = "Id,Name")] City city) { if (ModelState.IsValid) { db.Entry(city).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(city)); }
public ActionResult Edit([Bind(Include = "Id,Type,Bedrooms,Rooms,Area,Floor,ResidentialDistrict,City,Price,Year,Extras")] Property property) { if (ModelState.IsValid) { db.Entry(property).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(property)); }