摘要: [HttpPost] public ActionResult RemoveFromCart(int id) { // Remove the item from the cart var cart = ShoppingCart.GetCart(this.HttpContext); // Get the name of the album to display confirmation string albumName = storeDB.Carts .Single(item => item.RecordId == id).Album.Title; // Remove from cart i 阅读全文
posted @ 2011-06-25 10:49 Ken-Cai 阅读(359) 评论(0) 推荐(0) 编辑
摘要:  Required – Indicates that the property is a required field DisplayName – Defines the text we want used on form fields and validation messages StringLength – Defines a maximum length for a string field Range – Gives a maximum and minimum value for a numeric field Bind – Lists fields to exclude 阅读全文
posted @ 2011-06-25 09:45 Ken-Cai 阅读(164) 评论(0) 推荐(0) 编辑
摘要: public ActionResult Create(){ViewBag.GenreId = new SelectList(db.Genres, "GenreId", "Name");ViewBag.ArtistId = new SelectList(db.Artists, "ArtistId", "Name");return View();}@Html.DropDownList("GenreId", String.Empty) 阅读全文
posted @ 2011-06-25 09:21 Ken-Cai 阅读(1029) 评论(0) 推荐(1) 编辑