예제 #1
0
파일: Form1.cs 프로젝트: Raindery/Exam
        private void btnAdd_Click(object sender, EventArgs e)
        {
            FlatForm flatForm = new FlatForm();

            DialogResult result = flatForm.ShowDialog(this);

            if (result == DialogResult.Cancel)
            {
                return;
            }


            var flat = Flat.CreateFlat(flatForm.cbReqType.SelectedItem.ToString(), (int)flatForm.numFloor.Value, (float)flatForm.numFootage.Value, flatForm.dateBuilding.Value.Date, flatForm.elevator.Checked, (int)flatForm.cbType.SelectedValue, (int)flatForm.cbClient.SelectedValue);

            using (db)
            {
                db.Flats.Add(flat);
                db.SaveChanges();
            }
        }