예제 #1
0
 public int RegisterCustomer(CustomerInterface.Customer customer)
 {
     using (DataClassesCustomerDataContext ctx = new DataClassesCustomerDataContext())
     {
         Customer customerToInsert;
         customerToInsert = new Customer();
         customerToInsert.CustomerName      = customer.CustomerName;
         customerToInsert.CustomerFirstName = customer.CustomerFirstName;
         ctx.Customer.InsertOnSubmit(customerToInsert);
         ctx.SubmitChanges();
         return(customerToInsert.CustomerID);
     }
 }
예제 #2
0
        public int RegisterCustomer(CustomerInterface.Customer customer)
        {
            Console.WriteLine(System.Security.Principal.WindowsIdentity.GetCurrent().Name);

            using (DataClassesCustomerDataContext ctx =
                       new DataClassesCustomerDataContext())
            {
                Customer customerToInsert;
                customerToInsert = new Customer();
                customerToInsert.CustomerName      = customer.CustomerName;
                customerToInsert.CustomerFirstName = customer.CustomerFirstName;
                ctx.Customer.InsertOnSubmit(customerToInsert);
                ctx.SubmitChanges();
                return(customerToInsert.CustomerID);
            }
        }