Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
            }
        }