Exemplo n.º 1
0
 public ActionResult Edit([Bind(Include = "Key,Value,Description")] Setting setting)
 {
     if (ModelState.IsValid)
     {
         db.Entry(setting).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(setting));
 }
Exemplo n.º 2
0
        public async Task <ActionResult> Edit(EditUserViewModel model)
        {
            if (ModelState.IsValid)
            {
                var Db   = new ScavengerHuntContext();
                var user = Db.Users.First(u => u.UserName == model.UserName);
                Db.Entry(user).State = System.Data.Entity.EntityState.Modified;
                await Db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Exemplo n.º 3
0
        public async Task<ActionResult> Edit(EditUserViewModel model)
        {
            if (ModelState.IsValid)
            {
                var Db = new ScavengerHuntContext();
                var user = Db.Users.First(u => u.UserName == model.UserName);
                Db.Entry(user).State = System.Data.Entity.EntityState.Modified;
                await Db.SaveChangesAsync();
                return RedirectToAction("Index");
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }