示例#1
0
        public async Task <IActionResult> PutProductSongGenre(Guid id, ProductSongGenre productSongGenre)
        {
            if (id != productSongGenre.Id)
            {
                return(BadRequest());
            }

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

            ChangeLog.AddUpdatedLog(_context, "SongGenres", productSongGenre);

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

            return(NoContent());
        }
示例#2
0
        public async Task <ActionResult <ProductSongGenre> > PostProductSongGenre(ProductSongGenre productSongGenre)
        {
            _context.ProductSongGenres.Add(productSongGenre);

            ChangeLog.AddCreatedLog(_context, "SongGenres", productSongGenre);

            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetProductSongGenre", new { id = productSongGenre.Id }, productSongGenre));
        }