/* select customer function equals to first name */ public static void SelectCustomers(string Firstname) { LinqToSQLDataContext db = new LinqToSQLDataContext(); CustomerData customer = db.CustomerDatas.FirstOrDefault(e => e.FirstName.Equals(Firstname)); Console.WriteLine(customer.CustomerId + " " + customer.FirstName + " " + customer.LastName + " " + customer.PhoneNumber); }
/* update customer details */ public static void UpdateCustomer() { LinqToSQLDataContext db = new LinqToSQLDataContext(); CustomerData customer = db.CustomerDatas.FirstOrDefault(c => c.FirstName.Equals("xyz")); customer.FirstName = "pqr"; db.SubmitChanges(); }
/* insert customer function */ public static void InsertCustomer(string customerFirstName, string customerLastName, string customerEmailId, string customerPhoneNumber) { LinqToSQLDataContext db = new LinqToSQLDataContext(); CustomerData customer = new CustomerData(); customer.FirstName = customerFirstName; customer.LastName = customerLastName; customer.EmailId = customerEmailId; customer.PhoneNumber = customerPhoneNumber; db.CustomerDatas.InsertOnSubmit(customer); db.SubmitChanges(); }
partial void DeleteCustomerData(CustomerData instance);
partial void UpdateCustomerData(CustomerData instance);
partial void InsertCustomerData(CustomerData instance);