コード例 #1
0
 public void Add(NewPayment payment)
 {
     if (_repository.Add(payment))
     {
         // Hooray, everything is fine!
     }
     else
     {
         // Oh no, everything is not fine!
     }
 }
コード例 #2
0
        public bool Add(NewPayment payment)
        {
            var request = _adapter.Adapt(payment);

            /* Here, magical things happen and you submit your request
             * to your web service, ORM, stored procedure, or whatever else
             * your universe uses to actually do data work. For the purposes
             * of this example, we're using a crappy app setting. You can use
             * the ResultDetails class with the associated Error/Warning info
             * objects to play with this a bit more if you want to mimic your
             * own environment a bit better. */

            return bool.Parse(ConfigurationManager.AppSettings["RepositoryCallWillFail"]);
        }