Ejemplo n.º 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());
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PutViewing(int id, [FromBody] ViewingModel Viewing)
        {
            if (id != Viewing.ID)
            {
                return(BadRequest());
            }

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

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

            return(Ok(new { saved = "true" }));
        }