public ActionResult Edit([Bind(Include = "AlbumID,Title,ReviewID")] Album album)
 {
     if (ModelState.IsValid)
     {
         db.Entry(album).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(album));
 }
 public ActionResult Edit([Bind(Include = "ArtistID,Albums,Name")] Artist artist)
 {
     if (ModelState.IsValid)
     {
         db.Entry(artist).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(artist));
 }
 public ActionResult Edit([Bind(Include = "ReviewId,Contents,ReviewerEmail")] Review review)
 {
     if (ModelState.IsValid)
     {
         db.Entry(review).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(review));
 }
Example #4
0
 public ActionResult Edit([Bind(Include = "ReviewID,AlbumID,Contents,ReviwerEmail")] Review review)
 {
     if (ModelState.IsValid)
     {
         db.Entry(review).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AlbumID = new SelectList(db.Albums, "AlbumID", "Title", review.AlbumID);
     return(View(review));
 }
 public ActionResult Edit([Bind(Include = "AlbumId,Title,ArtistId")] 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);
     return(View(album));
 }
Example #6
0
 public ActionResult Edit(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));
 }
        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"));
            }
            var model = new AlbumEditViewModel()
            {
                Album   = album,
                Artists = new SelectList(db.Artists, "ArtistId", "Name", album.ArtistId),
                Genres  = new SelectList(db.Genres, "GenreId", "Name", album.GenreId)
            };

            return(View(model));
        }