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);
     }
 }
        public int RegisterCustomer(CustomInterface.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;

            }
        }
示例#3
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);
            }
        }