public void updateCustomer(Customer anCustomer) { using (SqlCommand cmd = DatabaseContext.Connection.CreateCommand()) { cmd.CommandText = "update customer set Name=" + "'" + anCustomer.Name + "'" + ",Street=" + "'" + anCustomer.Street + "',StreetNo='" + anCustomer.StreetNo + "', ZipCode='" + anCustomer.ZipCode + "',City='" + anCustomer.City+ "' where customerno=" + anCustomer.CustomerNo + ";"; cmd.ExecuteNonQuery(); } }
public Customer getCustomerByNo(int no) { Customer result = null; using (SqlCommand cmd = new SqlCommand("select * from customer where customerNo = " + no, DatabaseContext.Connection)) { SqlDataReader reader = cmd.ExecuteReader(); while(reader.Read()) { result = new Customer { Name = reader["Name"].ToString() }; } } return result; }
public void updateCustomer(Customer anCustomer) { context.CustomerRepository.updateCustomer(anCustomer); }
private void updateCustomer() { Customer anCustomer = new Customer { CustomerNo = Int32.Parse(tbAdminCustomerNo.Text), Name = tbAdminCustomerName.Text.ToString(), Street = tbAdminCustomerStreet.Text.ToString(), StreetNo = Int32.Parse(tbAdminCustomerStreetNo.Text), ZipCode = Int32.Parse(tbAdminCustomerZipCode.Text), City = tbAdminCustomerCity.Text.ToString(), }; context.CustomerService.updateCustomer(anCustomer); }