public ActionResult AddPatient(Common.Doctor d, Common.DiagnosisPatient dp, Common.PatientsEmployee pe, Common.Patient pat, Common.Person per, string txtStreetP, string txtPropertyP, Guid?locality, Guid?street, string txtOnc, Guid?ddOnc, string txtCon, Guid?ddCon, string txtFD, Guid?ddFD) { BusinessLayer.PatientsBL patient = new BusinessLayer.PatientsBL(); try { if (per.IdCardNumber != null) { if (patient.CheckRegister(per.IdCardNumber)) { patient.RegisterPerson(per, txtStreetP, txtPropertyP, locality, street); pat.Personfk = per.PersonID; patient.RegisterPatient(pat); if (pe.EmployeeId_fk != Guid.Empty) { patient.AddKeyWorker(pe); } if (dp.DiagnosisType_fk != Guid.Empty && dp.DiagnosisType_fk != null)//Issue Fix it { patient.AddDiagnosis(dp); } patient.AddDoctor(d, txtCon, txtOnc, txtFD, ddCon, ddFD, ddOnc); } } else { patient.RegisterPerson(per, txtStreetP, txtPropertyP, locality, street); pat.Personfk = per.PersonID; patient.RegisterPatient(pat); if (pe.EmployeeId_fk != Guid.Empty) { patient.AddKeyWorker(pe); } if (dp.DiagnosisType_fk != Guid.Empty && dp.DiagnosisType_fk != null)//Issue Fix it { patient.AddDiagnosis(dp); } patient.AddDoctor(d, txtCon, txtOnc, txtFD, ddCon, ddFD, ddOnc); } } catch (Exception ex) { throw ex; } return(Json("Valid", JsonRequestBehavior.AllowGet)); }