Beispiel #1
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());
        }
Beispiel #2
0
        public async Task <IActionResult> PutComments(int id, Comments comments)
        {
            if (id != comments.CommentId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Beispiel #3
0
 public void UpdateMovie(Movie movie)
 {
     context.Entry(movie).State = EntityState.Modified;
 }