Пример #1
0
        private void guna2Button2_Click(object sender, EventArgs e)
        {
            using (var context = new YTeDbContext())
            {
                var phongKham = context.PhongKhams.Where(s => s.TenPhongKham == phongkham).FirstOrDefault();
                var People    = context.DatLichKhams.Where(s => s.ID_PhongKham == phongKham.ID_PhongKham).FirstOrDefault();
                var people    = new ConNguoi();
                {
                    people.HoTen       = txtHoTen.Text;
                    people.SoCMND      = txtCMND.Text;
                    people.SoDienThoai = txtSDT.Text;
                    people.Email       = txtEmail.Text;
                    people.DiaChi      = txtDiaChi.Text;
                    //  people.GioiTinh = cbGioiTinh.Text;
                }
                context.ConNguois.Add(people);
                context.SaveChanges();

                var connguoi = new DatLichKham();
                {
                    connguoi.GhiChu       = txtGhiChu.Text;
                    connguoi.LyDoKham     = txtLyDoKham.Text;
                    connguoi.ID_PhongKham = People.ID_PhongKham;
                }
                context.DatLichKhams.Add(connguoi);
                context.SaveChanges();
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            ConNguoi nguoi = new ConNguoi();

            nguoi.HoTen = "Nguyen Van A";
            nguoi.CMND  = "12344";
            nguoi.Hello();
            Console.ReadLine();
        }