Пример #1
0
        public ActionResult Edit(EditUserViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            using (var db = new CursoMVCEntities())
            {
                var oUser = db.User.Find(model.Id);
                oUser.email    = model.Email;
                oUser.nombre   = model.Nombre;
                oUser.telefono = model.Telefono;

                if (model.Password != null && model.Password.Trim() != "")
                {
                    oUser.password = model.Password;
                }

                db.Entry(oUser).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }


            return(Redirect(Url.Content("~/User/")));
        }
Пример #2
0
 public ActionResult Delete(int id)
 {
     using (var bd = new CursoMVCEntities())
     {
         var ouser = bd.usuarios.Find(id);
         ouser.idEstado        = 2;
         bd.Entry(ouser).State = System.Data.Entity.EntityState.Modified;
         bd.SaveChanges();
     }
     return(Content("1"));
 }
Пример #3
0
        public ActionResult Delete(int Id)
        {
            using (var db = new CursoMVCEntities())
            {
                var oUser = db.user.Find(Id);
                oUser.id_cstate = 3; // Lo ponemos en el estado "Eliminado"

                db.Entry(oUser).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }
            return(Content("1"));
        }
Пример #4
0
        public ActionResult Delete(int Id)
        {
            using (var db = new CursoMVCEntities())
            {
                var oUser = db.Activos.Find(Id);
                oUser.idEstado = 3; //eliminaremos

                db.Entry(oUser).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }

            return(Content("1"));
        }
      public ActionResult Edit(Guid id, CatPeliculas peliculas)
      {
          try
          {
              peliculas.Id = id;

              Peliculas _Peliculas = new Peliculas()
              {
                  Descripcion    = peliculas.Descripcion,
                  IdCatPeliculas = peliculas.Id,
                  Titulo         = peliculas.Titulo
              };

              db.Entry(_Peliculas).State = System.Data.Entity.EntityState.Modified;
              db.SaveChanges();
              return(RedirectToAction("Index"));
          }
          catch
          {
              return(View());
          }
      }
Пример #6
0
        public ActionResult Edit(EditActivosViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            using (var db = new CursoMVCEntities())
            {
                var oUser = db.Activos.Find(model.Id);
                oUser.Marca         = model.Marca;
                oUser.Serial        = model.Serial;
                oUser.Observaciones = model.Observaciones;



                db.Entry(oUser).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
            }


            return(Redirect(Url.Content("~/Activos/")));
        }
Пример #7
0
        public ActionResult Editar(EditUsuarioViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            else
            {
                using (var bd = new CursoMVCEntities())
                {
                    var ousu = bd.usuarios.Find(model.Id);
                    ousu.email = model.Email;
                    ousu.edad  = model.Edad;
                    if (model.Password != null && model.Password.Trim() != "")
                    {
                        ousu.password = model.Password;
                    }

                    bd.Entry(ousu).State = System.Data.Entity.EntityState.Modified;
                    bd.SaveChanges();
                }
                return(Redirect(Url.Content("~/Usuarios/")));
            }
        }