private void button2_Click(object sender, EventArgs e) { var book = new { Id = Convert.ToInt32(textBox2.Text), Name = textBox3.Text, Author = textBox4.Text, Edition = textBox5.Text }; var result = BookController.AddFood(book); if (result) { MessageBox.Show("Book Added"); } else { MessageBox.Show("Book Couldnt't Added"); } }