private void AddPaymentInfoToAccount(AccountViewModel account, PaymentInfo paymentInfo) { Common.ValidateArgument<AccountViewModel>(account, "account"); Common.ValidateArgument<PaymentInfo>(paymentInfo, "paymentInfo"); PaymentInfoLogic piLogic = new PaymentInfoLogic(); PaymentInfo existingPaymentInfo = piLogic.GetPaymentInfoByPaymentInfoGuid(paymentInfo.PaymentInfoGuid); if (existingPaymentInfo == null || existingPaymentInfo.PaymentInfoGuid == Guid.Empty) { paymentInfo = piLogic.InsertPaymentInfo(paymentInfo); } else { paymentInfo.PaymentInfoGuid = existingPaymentInfo.PaymentInfoGuid; piLogic.UpdatePaymentInfo(paymentInfo); paymentInfo = piLogic.GetPaymentInfoByPaymentInfoGuid(paymentInfo.PaymentInfoGuid); } account.PaymentInfoGuid = paymentInfo.PaymentInfoGuid; }
public void UpdatePaymentInfo(DC.PaymentInfo request) { try { BL.PaymentInfoLogic paymentInfoLogic = new BL.PaymentInfoLogic(); BE.PaymentInfo entity = request.ToBusinessEntity(); paymentInfoLogic.UpdatePaymentInfo(entity); } catch (BE.PaymentInfoNotFoundException ex) { FC.DefaultFaultContract fault = new FC.DefaultFaultContract(); fault.ErrorMessage = String.Format( "Unable to update Payment Info data. Data: {0}", request.ToBusinessEntity().ToString()); throw new FaultException<FC.DefaultFaultContract>(fault, new FaultReason(ex.Message)); } }