public IActionResult DeleteAccountConfirm() { var details = SessionController.GetPatientDetails(HttpContext.Session); int id = details.Id; PatientProcessor.DeletePatient(id); SessionController.Logout(HttpContext.Session); return(View("Index")); }
public IActionResult Login(Admin admin) { AdminModel adminModel = AdminProcessor.AuthoriseAdmin(admin.Username, admin.Password); if (adminModel != null) { SessionController.Login(HttpContext.Session, adminModel); return(RedirectToAction("Index")); } ViewData["ErrorMessage"] = "Incorrect login details"; return(View()); }
public IActionResult ChangePassword(PatientModel patientM) { int id = SessionController.GetId(HttpContext.Session); PatientModel currentPatient = PatientProcessor.LoadPatient(id); String currentPassword = currentPatient.Password; if (patientM.Password == currentPassword) { PatientProcessor.UpdatePatientPassword(id, patientM.NewPassword); return(PartialView("_StatusMessagePartial", new Tuple <bool, string>(false, $"Password Successfully Updated"))); } else { return(PartialView("_StatusMessagePartial", new Tuple <bool, string>(false, $"Current Password did Not match, Password Not Updated"))); } }
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()); }
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)); }
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)); }