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(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"));
        }
        public void TestAddPatient()
        {
            Patient patient = new Patient();

            patient.PatientUser            = new User();
            patient.PatientUser.Name       = "Test";
            patient.PatientUser.Password   = patient.PatientUser.ConfirmPassword = "******";
            patient.PatientUser.Email      = "*****@*****.**";
            patient.PatientUser.BloodGroup = Models.Enum.BloodGroup.B;
            patient.PatientUser.Gender     = Models.Enum.Gender.Male;
            patient.PatientUser.Contact    = "7232392398";
            patient.Height  = 6;
            patient.Weight  = 73;
            patient.Address = "#123 Panchkula";
            patient.EmergencyContactNumber = "8124393000";
            patient.EmergengyContactName   = "TestFather";
            PatientBusinessLayer businessLayer = new PatientBusinessLayer();

            businessLayer.AddPatient(patient);
            Assert.AreEqual("Test", businessLayer.GetPatientNameById(patient.Id));
        }