public ActionResult CreateForUser(int userId, FormCollection form)
 {
     var user = db.Users.Find(userId);
     var shelf = new db.Shelf { Name = form["New Shelf"], Users = new List<User> { user } };
     db.Shelves.Add(shelf);
     db.SaveChanges();
     Response.Redirect("~");
     return View();
 }
        public ActionResult Create(Shelf shelf)
        {
            if (ModelState.IsValid)
            {
                db.Shelves.Add(shelf);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(shelf);
        }
 public ActionResult Edit(Shelf shelf)
 {
     if (ModelState.IsValid)
     {
         db.Entry(shelf).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(shelf);
 }