Ejemplo n.º 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();
     }
 }
Ejemplo n.º 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}");
         }
     }
 }
Ejemplo n.º 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();
            }
        }