Ejemplo n.º 1
0
        public IActionResult Index()
        {
            var viewmodel = new HRS.ViewModel.MakeAnAppointmentViewModel
            {
                clinics = hrsContext.GetClinics()
            };

            return(View(viewmodel));
        }
Ejemplo n.º 2
0
        public IActionResult Add(HRS.ViewModel.MakeAnAppointmentViewModel makeAnAppointment)
        {
            using (SqlConnection sqlConnection = new SqlConnection(_connection))
            {
                sqlConnection.Open();



                string query = "INSERT INTO PatientAppointments(ClinicId,DoctorId,TimeId,TransactionDate) VALUES (@p1,@p2,@p3,@p4)";

                SqlCommand sqlCommand = new SqlCommand(query, sqlConnection);

                sqlCommand.Parameters.AddWithValue("@p1", makeAnAppointment.ClinicId);
                sqlCommand.Parameters.AddWithValue("@p2", makeAnAppointment.DoctorId);
                sqlCommand.Parameters.AddWithValue("@p3", makeAnAppointment.TimeId);
                sqlCommand.Parameters.AddWithValue("@p4", makeAnAppointment.TransactionDate);

                sqlCommand.ExecuteNonQuery();
            }
            return(RedirectToAction("Index"));
        }