Exemplo n.º 1
0
        public async Task <ActionResult <Movie_Discount> > PostMovie_Discount(Movie_Discount movie_Discount)
        {
            _context.movie_Discounts.Add(movie_Discount);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetMovie_Discount", new { id = movie_Discount.id }, movie_Discount));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> PutMovie_Discount(int id, Movie_Discount movie_Discount)
        {
            if (id != movie_Discount.id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }