//加入购物车 public ActionResult AddToShelf(Reader reader, Shelf shelf, int Id, string returnUrl) { //根据Id获取Book(BookSummary的表单只传递了id参数) Book book = repository.Books.FirstOrDefault(p => p.Id == Id); //将该书放入书架 shelf.AddItem(book); return(RedirectToAction("Index", new { returnUrl })); }