public DataTable GetSportsList(string continent) { SportServiceClient client = new SportServiceClient("BasicHttpBindingDemo"); DataTable dt = client.GetSportsList(continent); return(dt); }
}//Press f5 to execute the Application.... private static void readAllCustomers() { var proxy = new SportServiceClient(); var data = proxy.GetAllCustomers(); foreach (var cst in data) { Console.WriteLine(cst.Name + " has paid " + cst.Fees); } }
private static void InsertCustomer() { SportServiceClient proxy = new SportServiceClient(); try { proxy.RegisterUser(new Customer { Name = "Rahul", ContactNo = 123456 });// U should add ID if the DB does not have identity set up } catch (FaultException fx) { Console.WriteLine(fx.Message); } catch (CommunicationException ex) { Console.WriteLine(ex.Message); } catch (Exception genEx) { Console.WriteLine(genEx.Message); } }
private static void insertRegistration() { try { SportServiceClient proxy = new SportServiceClient(); proxy.RegisterUser(new Customer { Name = "Rahul", ContactNo = 23424555 });//U should also add the ID if the Db does not have identity... } catch (FaultException fx) { Console.WriteLine(fx.Message); } catch (CommunicationException ex)//WCF related Exceptions { Console.WriteLine(ex.Message); } catch (Exception genEx) { Console.WriteLine(genEx.Message); } }