public void CreateArtist(Artist artist)
 {
     if (artist == null)
     {
         throw new ArgumentNullException(nameof(artist));
     }
     _context.Add(artist);
 }
        public async Task <IActionResult> Create([Bind("BandId,CategoryId,BandName")] Bands bands)
        {
            if (ModelState.IsValid)
            {
                _context.Add(bands);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(bands));
        }
        public async Task <IActionResult> Create([Bind("SongId,ArtistId,BandId,CategoryId,ArtistName,timeDuration,Popularity,Price")] Song song)
        {
            if (ModelState.IsValid)
            {
                _context.Add(song);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(song));
        }
        public async Task <IActionResult> Create([Bind("ArtistId,BandId,ArtistName")] Artist artist)
        {
            if (ModelState.IsValid)
            {
                _context.Add(artist);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(artist));
        }
예제 #5
0
        public IActionResult Save(Products product)
        {
            if (product.Id > 0)
            {
                _musicStoreContext.Update(product);
            }
            else
            {
                _musicStoreContext.Add(product);
            }

            _musicStoreContext.SaveChanges();

            return(RedirectToAction("Edit", new { id = product.Id }));
        }
예제 #6
0
 public Genre Add(Genre newGenre)
 {
     _context.Add(newGenre);
     _context.SaveChanges();
     return(newGenre);
 }
예제 #7
0
 public Artist Add(Artist newArtist)
 {
     _context.Add(newArtist);
     _context.SaveChanges();
     return(newArtist);
 }
예제 #8
0
 public Album Add(Album newAlbum)
 {
     _context.Add(newAlbum);
     _context.SaveChanges();
     return(newAlbum);
 }