Пример #1
0
 public ActionResult Edit([Bind(Include = "idEntities,Nombre,Descripcion,Activo")] Entities entities)
 {
     if (ModelState.IsValid)
     {
         db.Entry(entities).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(entities));
 }
Пример #2
0
 public ActionResult Edit([Bind(Include = "idUser,Rut,Nombre,Apellido,MailInstitucional,Contrasena,Activo,idRole")] Administrator administrator)
 {
     if (ModelState.IsValid)
     {
         administrator.Contrasena      = encoder.EncodePasswordMd5(administrator.Contrasena);
         db.Entry(administrator).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.idRole = new SelectList(db.Role, "idRole", "Nombre", administrator.idRole);
     return(View(administrator));
 }
Пример #3
0
 public ActionResult Edit([Bind(Include = "idProcess,Criterio,Descripcion")] Process process)
 {
     if (ModelState.IsValid)
     {
         db.Entry(process).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(process));
 }
Пример #4
0
 public ActionResult Edit([Bind(Include = "idCareer,Nombre,Descripcion")] Career career)
 {
     if (ModelState.IsValid)
     {
         db.Entry(career).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(career));
 }
Пример #5
0
        public async Task <ActionResult> ResetPass(User usuario)
        {
            User user = (User)TempData["account"];

            using (SMGPAContext db = new SMGPAContext())
            {
                db.Configuration.ValidateOnSaveEnabled = false;
                User u = await db.User.FindAsync(user.idUser);

                u.Contrasena = mdencoder.EncodePasswordMd5(usuario.Contrasena);
                db.User.Attach(u);
                db.Entry(u).Property(x => x.Contrasena).IsModified = true;
                await db.SaveChangesAsync();

                ViewBag.MensajeRestablecido = "Contraseña restablecida";
                return(View());
            }
        }