public void CreateBook(Book book) { using (SqlConnection connection = base.GetConnection()) { SqlCommand command = new SqlCommand("_BookUpdate", connection) { CommandType = CommandType.StoredProcedure }; command.Parameters.AddWithValue("@Type", 0); command.Parameters.AddWithValue("@BookID", 0); command.Parameters.AddWithValue("@ProductID", book.ProductID); command.Parameters.AddWithValue("@FromDate", book.FromDate); command.Parameters.AddWithValue("@ToDate", book.ToDate); command.Parameters.AddWithValue("@Actived", book.Actived); command.Parameters.AddWithValue("@FullName", book.FullName); command.Parameters.AddWithValue("@Email", book.Email); command.Parameters.AddWithValue("@Phone", book.Phone); command.Parameters.AddWithValue("@Address", book.Address); command.Parameters.AddWithValue("@Road", book.Road); command.Parameters.AddWithValue("@Other", book.Other); command.Parameters.AddWithValue("@FromCity", book.FromCity); command.Parameters.AddWithValue("@ToCity", book.ToCity); command.Parameters.AddWithValue("@FromDistrict", book.FromDistrict); command.Parameters.AddWithValue("@FromAddress", book.FromAddress); command.Parameters.AddWithValue("@ToDistrict", book.ToDistrict); command.Parameters.AddWithValue("@ToAddress", book.ToAddress); connection.Open(); if (command.ExecuteNonQuery() <= 0) { throw new DataAccessException("Lỗi kh\x00f4ng thể tao moi"); } command.Dispose(); } }
public void UpdateBook(Book book) { new BookDAO().UpdateBook(book); }
public void CreateBook(Book book) { new BookDAO().CreateBook(book); }