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