protected void SaveButton_Click(object sender, EventArgs e)
        {
            using (var db = new Models.ExampleDBEntities())
            {
                using (var trans = db.Database.BeginTransaction())
                {
                    try
                    {
                        int titleId = Convert.ToInt32(TitleDropDownList.SelectedValue);
                        int genderId = Convert.ToInt32(GenderDropDownList.SelectedValue);

                        Models.Student student = new Models.Student();
                        student.FirstName = new Models.Name { TH = FirstNameTHTextBox.Text, EN = FirstNameENTextBox.Text };
                        student.LastName = new Models.Name { TH = LastNameTHTextBox.Text, EN = LastNameENTextBox.Text };
                        student.Title = db.Titles.Where(m => m.Id == titleId).FirstOrDefault();
                        student.Gender = db.GenderSet.Where(m => m.Id == genderId).FirstOrDefault();
                        student.Age = Convert.ToInt16(AgeTextBox.Text);
                        student.GPA = Convert.ToSingle(GPATextBox.Text);
                        student.UpdatedDate = DateTime.Now;

                        db.People.Add(student);

                        db.SaveChanges();
                        trans.Commit();
                        Response.Redirect("StudentGridForm.aspx");
                    }
                    catch (Exception ex)
                    {
                        trans.Rollback();
                        Response.Write(ex.Message);
                    }
                }
            }
        }
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            using (var db = new Models.ExampleDBEntities())
            {
                using (var trans = db.Database.BeginTransaction())
                {
                    try
                    {
                        int titleId  = Convert.ToInt32(TitleDropDownList.SelectedValue);
                        int genderId = Convert.ToInt32(GenderDropDownList.SelectedValue);

                        Models.Student student = new Models.Student();
                        student.FirstName = new Models.Name {
                            TH = FirstNameTHTextBox.Text, EN = FirstNameENTextBox.Text
                        };
                        student.LastName = new Models.Name {
                            TH = LastNameTHTextBox.Text, EN = LastNameENTextBox.Text
                        };
                        student.Title       = db.Titles.Where(m => m.Id == titleId).FirstOrDefault();
                        student.Gender      = db.GenderSet.Where(m => m.Id == genderId).FirstOrDefault();
                        student.Age         = Convert.ToInt16(AgeTextBox.Text);
                        student.GPA         = Convert.ToSingle(GPATextBox.Text);
                        student.UpdatedDate = DateTime.Now;

                        db.People.Add(student);

                        db.SaveChanges();
                        trans.Commit();
                        Response.Redirect("StudentGridForm.aspx");
                    }
                    catch (Exception ex)
                    {
                        trans.Rollback();
                        Response.Write(ex.Message);
                    }
                }
            }
        }