public IActionResult OnPostDelete(int id)
        {
            var patient = patientService.DeletePatient(id);

            if (patient == null)
            {
                return(NotFound());
            }
            patientService.Commit();
            Hospital = hospitalService.GetHospitalById(patient.HospitalId);

            return(RedirectToPage("/Hospitals/PatientsInHospital", new { id = Hospital.Id }));
        }
Ejemplo n.º 2
0
        public IActionResult OnPost()
        {
            if (ModelState.IsValid)
            {
                Patient = patientServices.EditPatient(Patient);

                patientServices.Commit();

                Hospital = hospitalService.GetHospitalById(Patient.HospitalId);

                return(RedirectToPage("/Hospitals/PatientsInHospital", new { id = Hospital.Id }));
            }

            SelectGender = htmlHelper.GetEnumSelectList <Gender>();
            return(Page());
        }
Ejemplo n.º 3
0
        public IActionResult OnPost()
        {
            if (ModelState.IsValid)
            {
                Patient            = patientService.CreatePatient(Patient);
                Patient.HospitalId = Hospital.Id;

                Hospital.Patients.Add(Patient);

                patientService.Commit();
                TempData["Message"] = "Patient Added in Hospital!";

                return(RedirectToPage("/Hospitals/PatientsInHospital", new { id = Hospital.Id }));
            }

            return(Page());
        }