static void Main(string[] args) { CustomerGateway customerGateway = new CustomerGateway(); int customerId = customerGateway.AddCustomer("Hasan", "Mehmet", Convert.ToDateTime("1990-03-28"), "Türkiye"); customerGateway.UpdateCustomer(customerId, "Hasan", "Mehmet", Convert.ToDateTime("1989-03-28"), "Türkiye"); customerGateway.RemoveCustomer(customerId); customerGateway.GetCustomerbyId(5); }
static void Main(string[] args) { CustomerGateway customerGateway = new CustomerGateway(); int customerId = customerGateway.AddCustomer("Hasan","Mehmet",Convert.ToDateTime("1990-03-28"),"Türkiye"); customerGateway.UpdateCustomer(customerId, "Hasan", "Mehmet", Convert.ToDateTime("1989-03-28"), "Türkiye"); customerGateway.RemoveCustomer(customerId); customerGateway.GetCustomerbyId(5); }
static void Main(string[] args) { // Usage - no ORM or Mapper for DTO example var productGateway = new ProductGateway(ConnectionString); var product = productGateway.GetById(1); var success = productGateway.DeleteById(2); foreach (DataRow row in product.Rows) { Console.WriteLine($"{row["ID"]} {row["name"]}"); } Console.WriteLine($"Is row deleted: {success}"); // Usage - with ORM var customerGateway = new CustomerGateway(new DemoContext()); var customer = customerGateway.SelectById(1); Console.WriteLine($"Customer last name: {customer.LastName}"); }