public void SaveOrder(Order newOrder) { var tempOrderAgreement = newOrder.OrderAgreement; newOrder.OrderAgreement = null; _orderRepository.Add(newOrder); if (tempOrderAgreement != null) { _orderAgreementRepository.Add(tempOrderAgreement); } }
public void SaveAgreement(Agreement newAgreement) { SetTempOrderAgreemenr(newAgreement); _agreementRepository.Add(newAgreement); if (tempOrderAgreement != null) { tempOrderAgreement.AgreementId = newAgreement.Id; if (_orderAgreementRepository.GetAllByExpression().Where(ordAgr => ordAgr.OrderId == tempOrderAgreement.OrderId).ToList() == null) { _orderAgreementRepository.Add(tempOrderAgreement); } } }