예제 #1
0
 static void addhospital()
 {
     using (var context = new Context())
     {
         Hospitals hp = new Hospitals();
         Console.WriteLine("Enter Hospital Name");
         hp.HospitalName = Console.ReadLine();
         context.Hospitals.Add(hp);
         context.SaveChanges();
     }
 }
예제 #2
0
 static void getHospital()
 {
     using (var context = new Context())
     {
         Hospitals hp = new Hospitals();
         //Console.WriteLine("Enter Hospital Id");
         foreach (var item in context.Hospitals.ToList())
         {
             Console.WriteLine($"ID {item.HospitalId} and Name {item.HospitalName}");
         }
     }
 }
예제 #3
0
        static void removehospital()
        {
            using (var context = new Context())
            {
                Hospitals hp = new Hospitals();
                Console.WriteLine("Enter Hospital Id");
                hp.HospitalId = Convert.ToInt32(Console.ReadLine());

                context.Hospitals.Remove(hp);
                context.SaveChanges();
            }
        }