public int Delete(Customer customer)
 {
     using (var connection = ConnectionFactory.GetOpenConnection())
     {
         return connection.Delete(customer);
     }
 }
Beispiel #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);
        }
Beispiel #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");
 }
Beispiel #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);
 }
 public Customer Update(Customer customer)
 {
     using (var connection = ConnectionFactory.GetOpenConnection())
     {
         connection.Update(customer);
         return customer;
     }
 }
 public Customer Insert(Customer customer)
 {
     using (var connection = ConnectionFactory.GetOpenConnection())
     {
         var id = connection.Insert(customer);
         customer.customer_id = (int)id;
         return customer;
     }
 }