Ejemplo n.º 1
0
        public ActionResult EditUser([Bind(Include = "userId,BirthDate,FullName,Gender")] EditViewModel editUser)
        {
            if (ModelState.IsValid)
            {
                pi_12Entities db   = new pi_12Entities();
                var           user = db.AspNetUsers.Find(editUser.userId);
                if (user == null)
                {
                    return(HttpNotFound());
                }
                if (editUser.userId == user.Id)
                {
                    user.BirthDate = editUser.BirthDate;
                    user.FullName  = editUser.FullName;
                    user.Gender    = editUser.Gender;

                    db.Entry(user).State = EntityState.Modified;

                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }

            return(View(editUser));
        }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "ID,Nome,PrecoBase,Imagem,Disponivel")] Ingrediente ingrediente)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ingrediente).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(ingrediente));
 }
 public ActionResult Edit([Bind(Include = "Id,Email,EmailConfirmed,PasswordHash,SecurityStamp,PhoneNumber,PhoneNumberConfirmed,TwoFactorEnabled,LockoutEndDateUtc,LockoutEnabled,AccessFailedCount,UserName,BirthDate,Gender,FullName")] AspNetUsers aspNetUsers)
 {
     if (ModelState.IsValid)
     {
         db.Entry(aspNetUsers).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(aspNetUsers));
 }
Ejemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "Id,Name")] AspNetRoles aspNetRoles)
 {
     if (ModelState.IsValid)
     {
         db.Entry(aspNetRoles).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(aspNetRoles));
 }
 public ActionResult Edit([Bind(Include = "ID,Nome")] Classe classe)
 {
     if (ModelState.IsValid)
     {
         db.Entry(classe).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(classe));
 }
 public ActionResult Edit([Bind(Include = "ID,Nome,Classe_ID,SubProduto_ID,PrecoBase,Imagem")] Produto produto)
 {
     if (ModelState.IsValid)
     {
         db.Entry(produto).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Classe_ID     = new SelectList(db.Classe, "ID", "Nome", produto.Classe_ID);
     ViewBag.SubProduto_ID = new SelectList(db.Produto, "ID", "Nome", produto.SubProduto_ID);
     return(View(produto));
 }