Esempio n. 1
0
        public ActionResult Save(User patient)
        {
            if ((IsEmailValid(patient.Email)) || (IsValid(patient.UserName)))
            {
                ViewBag.Message = "User name or Email already exists, please try another user name!";
                PMSEntities1 db = new PMSEntities1();
                return(View("Add"));
            }

            else
            {
                int userId = _userRepo.Save(patient);
                patient.Patients.First().UserId = userId;
                int pateintId = _patientRepo.Save(patient.Patients.First());

                patient.Patients.First().PatientPhysicians.First().PatientId = pateintId;
                _patientRepo.SavePatientPhysician(patient.Patients.First().PatientPhysicians.First());
                return(RedirectToAction("Index", "Patient", new { }));
            }
        }