示例#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());
            }
        }