public ActionResult Create(Patient patient) { if (!ModelState.IsValid) { return(View(patient)); } if (!UserDataLayer.CheckEmail(patient.PatientUser.Email)) { ModelState.AddModelError("PatientUser.Email", "Email already exists"); return(View(patient)); } patient.PatientUser.Role = Models.Enum.Role.Patient; patientBusinessLayer.AddPatient(patient); Logging.loggInfo($"Patient addedd with User id = {patient.PatientUser.Id} and Name = {patient.PatientUser.Name}"); return(RedirectToAction("Index")); }
public ActionResult Create(Nurse nurse) { if (!ModelState.IsValid) { return(View(nurse)); } if (!UserDataLayer.CheckEmail(nurse.NurseUser.Email)) { ModelState.AddModelError("NurseUser.Email", "Email already exists"); return(View(nurse)); } nurse.NurseUser.Role = Models.Enum.Role.Nurse; nurseBusinessLayer.AddNurse(nurse); Logging.loggInfo($"Nurse addedd with id = {nurse.NurseUser.Id} and Name = {nurse.NurseUser.Name}"); return(RedirectToAction("Index")); }
public ActionResult Create(Patient patient) { if (!ModelState.IsValid) { return(View(patient)); } PatientBusinessLayer patientUser = new PatientBusinessLayer(); if (!UserDataLayer.CheckEmail(patient.PatientUser.Email)) { ModelState.AddModelError("PatientUser.Email", "Email already exists"); Logging.loggError($"{patient.PatientUser.Email} is already exist as email"); return(View(patient)); } patient.PatientUser.Role = Models.Enum.Role.Patient; patientUser.AddPatient(patient); Logging.loggInfo($"Patient addedd with id = {patient.PatientUser.Id}"); return(Redirect("/Login/Index")); }