Exemplo n.º 1
0
        public IActionResult DeleteCustomer(int Id)
        {
            var customerInDb = _context.Customers.SingleOrDefault(c => c.Id == Id);

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

            _context.Remove(customerInDb);
            _context.SaveChanges();
            return(Ok("The record was deleted successfully!"));
        }
Exemplo n.º 2
0
        public IActionResult DeleteMovie(int Id)
        {
            var movieInDb = _context.Movies.SingleOrDefault(m => m.Id == Id);

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

            _context.Remove(movieInDb);
            _context.SaveChanges();

            return(Ok("The record was deleted successfully!"));
        }