Esempio n. 1
0
 public int Delete(Customer customer)
 {
     using (var connection = ConnectionFactory.GetOpenConnection())
     {
         return connection.Delete(customer);
     }
 }
Esempio n. 2
0
        public void DeleteCustomerTest()
        {
            Customer customer = new Customer { first_name = "Claudio", last_name = "Barca", address_id = 530 };
            customer = customerRepository.Insert(customer);
            customer.customer_id.Should().BeGreaterThan(0);

            int? rowsAffected = customerRepository.Delete(customer);
            rowsAffected.Should().Be(1);
        }
Esempio n. 3
0
 public void UpdateCustomerEntityTest()
 {
     Customer customer = new Customer { first_name = "Miriam", last_name = "Barca", address_id = 530 };
     customer = customerRepository.Insert(customer);
     customer.first_name = "Clara";
     customerRepository.Update(customer);
     customer.first_name.Should().Be("Clara");
 }
Esempio n. 4
0
 public void InsertCustomerEntityTest()
 {
     Customer customer = new Customer { first_name = "Miriam", last_name = "Barca", address_id = 530 };
     customer = customerRepository.Insert(customer);
     customer.customer_id.Should().BeGreaterThan(0);
 }
Esempio n. 5
0
 public Customer Update(Customer customer)
 {
     using (var connection = ConnectionFactory.GetOpenConnection())
     {
         connection.Update(customer);
         return customer;
     }
 }
Esempio n. 6
0
 public Customer Insert(Customer customer)
 {
     using (var connection = ConnectionFactory.GetOpenConnection())
     {
         var id = connection.Insert(customer);
         customer.customer_id = (int)id;
         return customer;
     }
 }