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(); } }
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}"); } } }
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(); } }