public ActionResult Create(FormCollection collection)
        {
            DepartmentAdd departmentAdd = new DepartmentAdd
            {
                dept = collection["dept"]
            };
            DepartmentAddPortal departmentAddPortal = new DepartmentAddPortal();

            departmentAddPortal.insert(departmentAdd);
            return(RedirectToAction("Create", "Doctor"));
        }
 public void insert(DepartmentAdd departmentAdd)
 {
     using (SqlConnection conn = new SqlConnection(cs))
     {
         string     query      = "insert into departments values(@dept_name)";
         SqlCommand sqlCommand = new SqlCommand(query, conn);
         sqlCommand.Parameters.AddWithValue("@dept_name", departmentAdd.dept);
         conn.Open();
         sqlCommand.ExecuteNonQuery();
     }
 }
        private void AddNewDepartment_Click(object sender, EventArgs e)
        {
            DepartmentAdd AddDepForm = new DepartmentAdd();

            AddDepForm.Show();
        }
        private void AddNewDepartment_Click_1(object sender, EventArgs e)
        {
            DepartmentAdd departmentAdd = new DepartmentAdd();

            departmentAdd.ShowDialog();
        }