public void assignAssistant()
 {
     using (var context = new HospitalManagementContext())
     {
         Console.WriteLine("Enter Patient Name:");
         string pname     = Console.ReadLine();
         var    appoint   = context.Appointments.Single(b => b.PatientName == pname);
         int    appointid = appoint.AppointmentId;
         Console.WriteLine("Enter AssistantName:");
         string assist           = Console.ReadLine();
         var    assistant        = context.HealthAssistants.Single(b => b.AssistantName == assist);
         int    assistid         = assistant.AssistantId;
         var    assignAssistants = new AssignAssistants()
         {
             AssistantId   = assistid,
             AppointmentId = appointid,
         };
         context.AssignAssistants.Add(assignAssistants);
         context.SaveChanges();
     }
 }
Beispiel #2
0
        public void AssignAssistant()
        {
            using (var HospitalMgmt = new HospitalManagementDbContext())
            {
                int assistantid, appoinmentId;
                Console.WriteLine("Enter assistantid you want to assign");
                assistantid = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("Enter AppointmentId in which you assign assistant");
                appoinmentId = Convert.ToInt32(Console.ReadLine());

                var assignassistant = new AssignAssistants
                {
                    AssistantId   = assistantid,
                    AppointmentId = appoinmentId
                };
                HospitalMgmt.AssignAssistants.Add(assignassistant);

                HospitalMgmt.SaveChanges();

                Console.WriteLine(" Successfully Assigned HealthCare Assistant");
            }
        }