public void addOrUpdatePhone(PhoneModel phone) { PhoneRepo repo = new PhoneRepo(); Phone p = repo.getById(new Phone {PHONE_ID=phone.phoneId }); if (p!=null){ repo.update(p); }else{ Phone p1 = new Phone(); p1.APPLICANT_ID = phone.applicantId; p1.CREATE_DT = DateTime.Now; p1.MOD_DT = DateTime.Now; p1.PHONE_CD=phone.phoneCd; p1.PHONE_TX=1231231234; repo.add(p1); } repo = null; }
/// <summary> /// Create a new Phone object. /// </summary> /// <param name="pHONE_ID">Initial value of the PHONE_ID property.</param> /// <param name="pHONE_CD">Initial value of the PHONE_CD property.</param> /// <param name="pHONE_TX">Initial value of the PHONE_TX property.</param> /// <param name="cREATE_DT">Initial value of the CREATE_DT property.</param> /// <param name="mOD_DT">Initial value of the MOD_DT property.</param> /// <param name="aPPLICANT_ID">Initial value of the APPLICANT_ID property.</param> public static Phone CreatePhone(global::System.Decimal pHONE_ID, global::System.String pHONE_CD, global::System.Decimal pHONE_TX, global::System.DateTime cREATE_DT, global::System.DateTime mOD_DT, global::System.Decimal aPPLICANT_ID) { Phone phone = new Phone(); phone.PHONE_ID = pHONE_ID; phone.PHONE_CD = pHONE_CD; phone.PHONE_TX = pHONE_TX; phone.CREATE_DT = cREATE_DT; phone.MOD_DT = mOD_DT; phone.APPLICANT_ID = aPPLICANT_ID; return phone; }
/// <summary> /// Deprecated Method for adding a new object to the Phones EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToPhones(Phone phone) { base.AddObject("Phones", phone); }