public int AddSave(Book.Model.T_Base_Book book) { Book.DAL.T_Base_Book bookAddSave = new DAL.T_Base_Book(); int result = bookAddSave.AddSave(book); return(result); }
public int AddSave(Book.Model.T_Base_Book book) { SqlConnection co = SQLServerOpen(); SqlCommand cmd = new SqlCommand(); cmd.Connection = co; cmd.CommandText = "insert into t_base_book values(@BookName,@Author," + "@ISBN,@PressName,@Version,@Price,@Img)"; cmd.Parameters.AddWithValue("@BookName", book.BookName); cmd.Parameters.AddWithValue("@Author", book.Author); cmd.Parameters.AddWithValue("@ISBN", book.ISBN); cmd.Parameters.AddWithValue("@PressName", book.PressName); cmd.Parameters.AddWithValue("@Version", book.Version); cmd.Parameters.AddWithValue("@Price", book.Price); cmd.Parameters.AddWithValue("@Img", book.Img); int result = cmd.ExecuteNonQuery(); cmd.Clone(); co.Close(); return result; }