Exemple #1
0
 public ActionResult Edit([Bind(Include = "Id,Name,ParentId")] Tree tree)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tree).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ParentId = GetSelectListFor(tree);
     return(View(tree));
 }
Exemple #2
0
 public int Edit(EasyTree entity)
 {
     using (TreeContext db = new TreeContext())
     {
         db.Set <EasyTree>().Attach(entity);
         db.Entry <EasyTree>(entity).State = EntityState.Modified;
         return(db.SaveChanges());
     }
 }