Ejemplo n.º 1
0
        private void UpdateCustomer()
        {
            BookingSystemEntities context = new BookingSystemEntities();

            //var updateQuery = from x in context.Customers
            //                where x.ID  == txtCustomerID.Text
            //                select x;

            // Execute the query, and change the column values
            // you want to change.

            customer.ID = txtCustomerID.Text;
            customer.Name = txtCustomerName.Text;
            customer.Department = CboDepartment.Text;
            customer.Address = rtbAddress.Text;
            customer.Email = txtEmail.Text;
            customer.PhoneNumber = txtPhoneNo.Text;
            customer.PostalCode = txtPostalCode.Text;

            context.SaveChanges();
            this.customer = null;
            // Insert any additional changes to column values.
        }
Ejemplo n.º 2
0
        private Customer SaveNew()
        {
            BookingSystemEntities context = new BookingSystemEntities();
            Customer customer = new Customer();

            customer.ID = txtCustomerID.Text;
            customer.Name = txtCustomerName.Text;
            customer.Department = CboDepartment.Text;
            customer.Address = rtbAddress.Text;
            customer.Email = txtEmail.Text;
            customer.PhoneNumber = txtPhoneNo.Text;
            customer.PostalCode = txtPostalCode.Text;

            //BookingSystemEntities context = new BookingSystemEntities();
            context.Customers.Add(customer);
            context.SaveChanges();

            return customer;
        }