public void CreateOrUpdate(PaymentBindingModel model) { if (model.Id.HasValue) { _paymentStorage.Update(model); } else { _paymentStorage.Insert(model); } }
public void CreateOrUpdate(PaymentBindingModel model) { var element = _paymentStorage.GetElement(new PaymentBindingModel { ContractId = model.ContractId }); if (element != null && element.Id != model.Id) { throw new Exception("Заказ уже оплачен"); } if (model.Id.HasValue) { _paymentStorage.Update(model); } else { _paymentStorage.Insert(model); } }