Exemplo n.º 1
0
        public void PaymentAmounts()
        {
            //Instance
            var context = new sakilaEntities();
            //Query
            var payments = from payment in context.payment
                           select payment;

            foreach (payment payment in payments)
            {
                Console.WriteLine(payment.amount + " " + payment.customer_id + " " + payment.last_update);
            }
            context.SaveChanges();
        }
Exemplo n.º 2
0
        public void StaffNames()
        {
            //Instance
            var context = new sakilaEntities();
            //Query
            var people = from person in context.staff
                         select person;

            foreach (staff person in people)
            {
                Console.WriteLine(person.first_name + " " + person.last_name);
            }
            context.SaveChanges();
        }
Exemplo n.º 3
0
        public void DeleteRental(int id)
        {
            //Instance
            var context = new sakilaEntities();

            try
            {
                var delete = context.rental.Where(rental => rental.rental_id == id).First();
                context.rental.Remove(delete);
                Console.WriteLine("Rental succesfully deleted");
            }
            catch (System.InvalidOperationException)
            {
                Console.WriteLine("Rental doesn't exist");
            }

            context.SaveChanges();
        }