Exemplo n.º 1
0
        public async Task <ActionResult <Users> > DeleteUsers(int id)
        {
            var users = await _context.Users.FindAsync(id);

            if (users == null)
            {
                return(NotFound());
            }

            _context.Users.Remove(users);
            await _context.SaveChangesAsync();

            return(users);
        }
Exemplo n.º 2
0
        public async Task <ActionResult <Loan> > DeleteLoan(int id)
        {
            //next line of code updates the data corresponding to the id in the Loan table
            var Loan = await _context.Loans.FindAsync(id);

            if (Loan == null)
            {
                return(NotFound());
            }

            _context.Loans.Remove(Loan);
            await _context.SaveChangesAsync();

            return(Loan);
        }
Exemplo n.º 3
0
        public async Task <ActionResult <Book> > DeleteBook(int id)
        {
            //next line of code updates the data corresponding to the id in the book table
            var Book = await _context.Books.FindAsync(id);

            if (Book == null)
            {
                return(NotFound());
            }

            _context.Books.Remove(Book);
            await _context.SaveChangesAsync();

            return(Book);
        }
Exemplo n.º 4
0
        public async Task <ActionResult <Order> > DeleteOrder(int id)
        {
            //next line of code updates the data corresponding to the id in the Order table
            var Order = await _context.Orders.FindAsync(id);

            if (Order == null)
            {
                return(NotFound());
            }

            _context.Orders.Remove(Order);
            await _context.SaveChangesAsync();

            return(Order);
        }