public async Task UpdateAsync(UserAddress address)
 {
     if (address == null)
     {
         throw new ArgumentNullException();
     }
     _context.Entry(address).State = EntityState.Modified;
     await _context.SaveChangesAsync();
 }
示例#2
0
 public async Task UpdateAsync(Artist artist)
 {
     if (artist == null)
     {
         throw new ArgumentNullException();
     }
     _context.Entry(artist).State = EntityState.Modified;
     await _context.SaveChangesAsync();
 }
示例#3
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));
 }
示例#4
0
 public ActionResult Edit([Bind(Include = "ArtistId,Name")] Artist artist)
 {
     if (ModelState.IsValid)
     {
         db.Entry(artist).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(artist));
 }
示例#5
0
        public async Task UpdateAsync(Album album)
        {
            bool exists = await _context.Albums.AnyAsync(s => s.AlbumId == album.AlbumId);

            if (!exists)
            {
                throw new ArgumentException();
            }

            _context.Entry(album).State = EntityState.Modified;
            await _context.SaveChangesAsync();
        }
 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));
 }
示例#7
0
 public async Task UpdateAsync(Genre genre)
 {
     _context.Entry(genre).State = EntityState.Modified;
     await _context.SaveChangesAsync();
 }