示例#1
0
        public async Task <IActionResult> PutUsers(int id, Users users)
        {
            if (id != users.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
示例#2
0
        public async Task <IActionResult> PutMovies(int id, Movies movies)
        {
            if (id != movies.Id)
            {
                return(BadRequest());
            }

            _contextDataBase.Entry(movies).State = EntityState.Modified;

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

            return(NoContent());
        }