Exemple #1
0
        public async Task <IActionResult> PutMovieList(int id, MovieList movieList)
        {
            if (id != movieList.MovieListId)
            {
                return(BadRequest());
            }

            MovieListEntry ml = new MovieListEntry {
                MovieId = 1, MovieListId = id
            };

            movieList.MovieListEntries.Add(ml);


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

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

            return(NoContent());
        }
Exemple #2
0
        public async Task <IActionResult> PutMovie(int id, Movie movie)
        {
            if (id != movie.MovieId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }