Exemplo n.º 1
0
        public async Task <ActionResult <Movies> > Post(Movies item)
        {
            _context.Movies.Add(item);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(
                       nameof(GetMovies),
                       item));
        }
Exemplo n.º 2
0
        public async Task <ActionResult <Wishlist> > PostWishlist(Wishlist item)
        {
            _context.Wishlist.Add(item);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(
                       nameof(GetWishlist),
                       item));
        }
Exemplo n.º 3
0
        public async Task <ActionResult <Users> > PostUsers(Users item)
        {
            _context.Users.Add(item);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(
                       nameof(GetUsers),
                       item));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> PutUsers(int id, Users item)
        {
            if (id != item.Id)
            {
                return(BadRequest());
            }

            _context.Entry(item).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(Content("User has been updated"));
        }