예제 #1
0
 public ActionResult Edit([Bind(Include = "GenreId,Name,Description")] Genre genre)
 {
     if (ModelState.IsValid)
     {
         db.Entry(genre).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(genre));
 }
예제 #2
0
 public ActionResult Edit([Bind(Include = "AlbumId,GenreId,ArtistId,Title,Price,AlbumArtUrl")] Album album)
 {
     if (ModelState.IsValid)
     {
         db.Entry(album).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ArtistId = new SelectList(db.Artists, "ArtistId", "Name", album.ArtistId);
     ViewBag.GenreId  = new SelectList(db.Genres, "GenreId", "Name", album.GenreId);
     return(View(album));
 }