示例#1
0
 public void CreateOrUpdate(PaymentBindingModel model)
 {
     if (model.Id.HasValue)
     {
         _paymentStorage.Update(model);
     }
     else
     {
         _paymentStorage.Insert(model);
     }
 }
示例#2
0
        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);
            }
        }