public IActionResult OnGet(int id)
 {
     Patient = patientData.GetPatientById(id);
     if (Patient == null)
     {
         return(RedirectToPage("~/NotFound"));
     }
     return(Page());
 }
        public IActionResult GetPatientById(int id)
        {
            var data = patientData.GetPatientById(id);

            if (data == null)
            {
                return(NotFound());
            }

            return(Ok(data));
        }
Esempio n. 3
0
        public IActionResult OnPost()
        {
            if (ModelState.IsValid)
            {
                var patient = patientData.GetPatientById(Appointment.PatientId);
                Appointment.Patient = patient;
                if (Appointment.Id == 0)
                {
                    Appointment             = appointmentData.Create(Appointment);
                    TempData["TempMessage"] = "New appointment created!";
                }
                else
                {
                    Appointment             = appointmentData.Update(Appointment);
                    TempData["TempMessage"] = "Appointment is updated!";
                }
                appointmentData.Commit();
                return(RedirectToPage("./List"));
            }
            var patients = patientData.GetPatients().ToList().Select(p => new { Id = p.Id, Display = $"{p.FirstName} {p.LastName}" });

            Patients = new SelectList(patients, "Id", "Display");
            Symptom  = htmlHelper.GetEnumSelectList <Symptom>();
            return(Page());
        }
Esempio n. 4
0
        public IActionResult OnGet(int?id)
        {
            if (id.HasValue)
            {
                Patient = patientData.GetPatientById(id.Value);
                if (Patient == null)
                {
                    return(RedirectToPage("./NotFound"));
                }
            }
            else
            {
                Patient = new Core.Patient();
            }
            var doctors = doctorData.GetDoctors().ToList().Select(d => new { Id = d.Id, Display = $"{d.FirstName} {d.LastName}" });

            Doctors = new SelectList(doctors, "Id", "Display");
            Gender  = htmlHelper.GetEnumSelectList <Gender>();
            return(Page());
        }