예제 #1
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         db.Dispose();
     }
     base.Dispose(disposing);
 }
예제 #2
0
        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));
        }
예제 #3
0
 public void Dispose()
 {
     userContext.Dispose();
     db.Dispose();
 }
예제 #4
0
 public void Dispose()
 {
     db.Dispose();
 }