protected void btnSave_Click(object sender, EventArgs e)
        {
            var departmentsID = Request.QueryString["ID"];

            if (departmentsID == null)
            {
                Contoso.Models.Departments departments = new Contoso.Models.Departments();
                departments.Name         = txtName.Text;
                departments.Budget       = Convert.ToDouble(txtBudget.Text);
                departments.StartDate    = Convert.ToDateTime(txtStartDate.Text);
                departments.InstructorID = Convert.ToInt32(ddlInstructorID.SelectedValue);
                departments.RowVersion   = Convert.ToInt32(txtRowVersion.Text);
                departments.CreatedDate  = Convert.ToDateTime(txtCreatedDate.Text);
                departments.CreatedBy    = txtCreatedBy.Text;
                departments.UpdatedDate  = Convert.ToDateTime(txtUpdatedDate.Text);
                departments.UpdatedBy    = txtUpdatedBy.Text;

                DepartmentsService departmentsService = new DepartmentsService();
                departmentsService.AddDepartments(departments);
            }
            if (departmentsID != null)
            {
                Contoso.Models.Departments departments = new Models.Departments();
                departments.ID           = Convert.ToInt32(departmentsID);
                departments.Name         = txtName.Text;
                departments.Budget       = Convert.ToDouble(txtBudget.Text);
                departments.StartDate    = Convert.ToDateTime(txtStartDate.Text);
                departments.InstructorID = Convert.ToInt32(ddlInstructorID.SelectedValue);
                departments.RowVersion   = Convert.ToInt32(txtRowVersion.Text);
                departments.CreatedDate  = Convert.ToDateTime(txtCreatedDate.Text);
                departments.CreatedBy    = txtCreatedBy.Text;
                departments.UpdatedDate  = Convert.ToDateTime(txtUpdatedDate.Text);
                departments.UpdatedBy    = txtUpdatedBy.Text;
                DepartmentsService departmentsService = new DepartmentsService();
                departmentsService.UpdateDepartments(departments);
            }
        }