示例#1
0
        public async Task <IActionResult> PutMovieGrade(long id, MovieGrade movieGrade)
        {
            if (id != movieGrade.MovieGradeID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#2
0
        public async Task <ActionResult <MovieGrade> > PostMovieGrade(MovieGrade movieGrade)
        {
            _context.MovieGrade.Add(movieGrade);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetMovieGrade", new { id = movieGrade.MovieGradeID }, movieGrade));
        }