Beispiel #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 async Task <IActionResult> Create([Bind("ID,Artist,Name,Genere,ReleaseDate,Price")] Albums albums)
        {
            if (ModelState.IsValid)
            {
                _context.Add(albums);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(albums));
        }