Exemple #1
0
        public async Task <IActionResult> PutMovieRating(int id, MovieRating movieRating)
        {
            if (id != movieRating.MovieRatingId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public async Task <IActionResult> PutUser(int id, User user)
        {
            if (id != user.UserId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
 public async Task Add(MovieComment e)
 {
     _context.MovieComment.Add(e);
     await _context.SaveChangesAsync();
 }
 public async Task Add(Movie movie)
 {
     _context.Movie.Add(movie);
     await _context.SaveChangesAsync();
 }