コード例 #1
0
        CreateDebitCard([Bind(debitProperties)] DebitCardViewModel c)
        {
            if (!ModelState.IsValid)
            {
                return(View(c));
            }
            c.ID = Guid.NewGuid().ToString();
            var o = PaymentObjectFactory.CreateDebit(c.ID, c.Amount, c.Currency, c.Memo, c.Payer, c.PayerAccountNumber,
                                                     c.CardAssociationName, c.CardNumber, c.DailyWithdrawalLimit, c.Payee, c.PayeeAccountNumber, c.ValidFrom,
                                                     c.ValidTo);
            await payments.AddObject(o);

            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public async Task <IActionResult> EditDebitCard([Bind(debitProperties)] DebitCardViewModel c)
        {
            if (!ModelState.IsValid)
            {
                return(View("EditDebitCard", c));
            }
            var o = await payments.GetObject(c.ID) as DebitCardObject;

            o.DbRecord.Payer = c.Payer;
            o.DbRecord.PayerAccountNumber = c.PayerAccountNumber;
            o.DbRecord.Payee = c.Payee;
            o.DbRecord.PayeeAccountNumber   = c.PayeeAccountNumber;
            o.DbRecord.Amount               = c.Amount;
            o.DbRecord.Currency             = c.Currency;
            o.DbRecord.CardAssociationName  = c.CardAssociationName;
            o.DbRecord.CardNumber           = c.CardNumber;
            o.DbRecord.DailyWithDrawalLimit = c.DailyWithdrawalLimit;
            o.DbRecord.Memo      = c.Memo;
            o.DbRecord.ValidFrom = c.ValidFrom ?? DateTime.MinValue;
            o.DbRecord.ValidTo   = c.ValidTo ?? DateTime.MaxValue;
            await payments.UpdateObject(o);

            return(RedirectToAction("Index"));
        }