摘要:
[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 阅读全文
摘要:
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 阅读全文
摘要:
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) 阅读全文