コード例 #1
0
        public async Task <IActionResult> PutMovies(int id, MoviesModel Movies)
        {
            if (id != Movies.ID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #2
0
        public async Task <ActionResult <ViewingModel> > PostViewing([FromBody] ViewingModel Viewing)
        {
            _context.Viewing.Add(Viewing);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetViewing", new { id = Viewing.ID }, Viewing));
        }