Example #1
0
        public async Task <IActionResult> PutAlbums(int id, Albums albums)
        {
            if (id != albums.Id)
            {
                return(BadRequest());
            }

            _context.Entry(albums).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AlbumsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
 public ActionResult Edit([Bind(Include = "GenreId,GenreName")] Genre genre)
 {
     if (ModelState.IsValid)
     {
         db.Entry(genre).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(genre));
 }
Example #3
0
 public ActionResult Edit([Bind(Include = "SongId,SongTitle,AlbumRefId")] Song song)
 {
     if (ModelState.IsValid)
     {
         db.Entry(song).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AlbumRefId = new SelectList(db.Albums, "AlbumId", "AlbumArtistName", song.AlbumRefId);
     return(View(song));
 }
Example #4
0
 public ActionResult Edit([Bind(Include = "AlbumId,AlbumArtistName,AlbumTitle,AlbumLogo,GenreRefId")] Album album)
 {
     if (ModelState.IsValid)
     {
         db.Entry(album).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.GenreRefId = new SelectList(db.Genres, "GenreId", "GenreName", album.GenreRefId);
     return(View(album));
 }