protected override void Dispose(bool disposing) { if (disposing) { db.Dispose(); } base.Dispose(disposing); }
public ActionResult Edit([Bind(Include = "UserId,UserName,Nombre,Apellido,Direccion,Telefono,Celular,CityId")] User user) { if (ModelState.IsValid) { var db2 = new VMarketContext(); var currentUser = db2.Users.Find(user.UserId); if (currentUser.UserName != user.UserName) { UsersHelper.UpdateUserName(currentUser.UserName, user.UserName); } db2.Dispose(); db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CityId = new SelectList(db.Cities, "CityId", "Name", user.CityId); return(View(user)); }
public void Dispose() { userContext.Dispose(); db.Dispose(); }
public void Dispose() { db.Dispose(); }