Ejemplo n.º 1
0
        public IActionResult DeleteAccountConfirm()
        {
            var details = SessionController.GetPatientDetails(HttpContext.Session);
            int id      = details.Id;

            PatientProcessor.DeletePatient(id);
            SessionController.Logout(HttpContext.Session);
            return(View("Index"));
        }
Ejemplo n.º 2
0
        public IActionResult Index()
        {
            var details = SessionController.GetPatientDetails(HttpContext.Session);

            if (details != null)
            {
                Calculation calculation = new Calculation
                {
                    Age       = details.DateOfBirth.GetAge(),
                    Gender    = (Gender)details.Gender,
                    Ethnicity = (Ethnicity)details.Ethnicity
                };

                return(View(calculation));
            }
            return(View());
        }
Ejemplo n.º 3
0
        public IActionResult Details(PatientDetails patientDetails)
        {
            PatientDetailsModel sessionDetails = SessionController.GetPatientDetails(HttpContext.Session);
            int result = UpdateDetails(patientDetails, sessionDetails);

            // Add validation
            // Insert details into db, either updating the details or creating a new row in the db
            if (result == 0)
            {
                ViewData["ErrorMessage"] = "There was a problem saving your details.";
            }
            else
            {
                // Update session details
                ViewData["SuccessMessage"] = "Your details have been updated.";
            }
            return(View(patientDetails));
        }
Ejemplo n.º 4
0
        public IActionResult Details()
        {
            PatientDetailsModel patientDetailsModel = SessionController.GetPatientDetails(HttpContext.Session);
            PatientDetails      patientDetails      = null;

            // Check that patient details were extracted from the session controller
            // Null details means that the logged on patient does not have details saved yet
            if (patientDetailsModel != null)
            {
                patientDetails = new PatientDetails
                {
                    DateOfBirth = patientDetailsModel.DateOfBirth,
                    Gender      = (Gender)patientDetailsModel.Gender,
                    Ethnicity   = (Ethnicity)patientDetailsModel.Ethnicity
                };
            }

            return(View(patientDetails));
        }