// public async Task<IActionResult> Create([Bind("Id,Age,Country,Fullname")] Artists artists)
        public async Task <IActionResult> Create([Bind("Id,Fullname,Country,Age")] Artists artists)
        {
            if (ModelState.IsValid)
            {
                _context.Add(artists);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(artists));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("Id,Name")] Album album)
        {
            if (ModelState.IsValid)
            {
                _context.Add(album);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(album));
        }
        public async Task <IActionResult> Create([Bind("Id,JenreId,AlbumId,Name")] Tracks tracks)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tracks);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AlbumId"] = new SelectList(_context.Album, "Id", "Name", tracks.AlbumId);
            ViewData["JenreId"] = new SelectList(_context.Jenres, "Id", "Name", tracks.JenreId);
            return(View(tracks));
        }
Beispiel #4
0
        public async Task <IActionResult> Create([Bind("Id,TrackId,ArtistId")] ArtistsTracks artistsTracks)
        {
            if (ModelState.IsValid)
            {
                _context.Add(artistsTracks);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ArtistId"] = new SelectList(_context.Artists, "Id", "Fullname", artistsTracks.ArtistId);
            ViewData["TrackId"]  = new SelectList(_context.Tracks, "Id", "Name", artistsTracks.TrackId);
            return(View(artistsTracks));
        }