public ActionResult AssociatePhysician(int physicianId, int patientId, bool isPrimary) { //Save selected physician for current patient (The patient whos detail is being shown) PatientPhysician pPhysician = new PatientPhysician(); pPhysician.PhysicianId = physicianId; pPhysician.PatientId = patientId; pPhysician.IsPrimary = isPrimary; _patientRepo.SavePatientPhysician(pPhysician); //Get list of saved patients for the current patient. and return this list to the patient detail page via ajax. ViewBag.PPhysicians = _patientRepo.GetPatientPhysicians(patientId); return(PartialView("_PartialPhysicians")); //return "response done"; }
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 { })); } }