public async Task <IActionResult> Details(string id) { var c = await payments.GetObject(id); switch (c) { case CashObject cash: return(View("DetailsCash", PaymentViewModelFactory.Create(cash) as CashViewModel)); case CheckObject check: return(View("DetailsCheck", PaymentViewModelFactory.Create(check) as CheckViewModel)); case DebitCardObject debit: return(View("DetailsDebitCard", PaymentViewModelFactory.Create(debit) as DebitCardViewModel)); case CreditCardObject credit: return(View("DetailsCreditCard", PaymentViewModelFactory.Create(credit) as CreditCardViewModel)); } return(RedirectToAction("Index")); }
public void CreateWithExtremumDatesTest() { var o = GetRandom.Object <CashObject>(); o.DbRecord.ValidFrom = DateTime.MinValue; o.DbRecord.ValidTo = DateTime.MaxValue; var v = PaymentViewModelFactory.Create(o); Assert.AreEqual(v.ID, o.DbRecord.ID); Assert.AreEqual(v.ValidFrom, null); Assert.AreEqual(v.ValidTo, null); }
public void CreateTest() { var v = PaymentViewModelFactory.Create(null) as CashViewModel; Assert.IsNotNull(v); Assert.AreEqual(v.ID, u); Assert.AreEqual(v.ValidFrom, null); Assert.AreEqual(v.ValidTo, null); Assert.AreEqual(v.Amount, u); Assert.AreEqual(v.Currency, u); Assert.AreEqual(v.Memo, u); Assert.AreEqual(v.Payee, u); Assert.AreEqual(v.PayeeAccountNumber, u); Assert.AreEqual(v.Payer, u); Assert.AreEqual(v.PayerAccountNumber, u); }
public void CreateCashTest() { var o = GetRandom.Object <CashObject>(); var v = PaymentViewModelFactory.Create(o) as CashViewModel; Assert.IsNotNull(v); Assert.AreEqual(v.ID, o.DbRecord.ID); Assert.AreEqual(v.ValidFrom, o.DbRecord.ValidFrom); Assert.AreEqual(v.ValidTo, o.DbRecord.ValidTo); Assert.AreEqual(v.Amount, o.DbRecord.Amount); Assert.AreEqual(v.Currency, o.DbRecord.Currency); Assert.AreEqual(v.Memo, o.DbRecord.Memo); Assert.AreEqual(v.Payee, o.DbRecord.Payee); Assert.AreEqual(v.PayeeAccountNumber, o.DbRecord.PayeeAccountNumber); Assert.AreEqual(v.Payer, o.DbRecord.Payer); Assert.AreEqual(v.PayerAccountNumber, o.DbRecord.PayerAccountNumber); }
public void CreateDebitCardTest() { var o = GetRandom.Object <DebitCardObject>(); var v = PaymentViewModelFactory.Create(o) as DebitCardViewModel; Assert.IsNotNull(v); Assert.AreEqual(v.ID, o.DbRecord.ID); Assert.AreEqual(v.ValidFrom, o.DbRecord.ValidFrom); Assert.AreEqual(v.ValidTo, o.DbRecord.ValidTo); Assert.AreEqual(v.Amount, o.DbRecord.Amount); Assert.AreEqual(v.Currency, o.DbRecord.Currency); Assert.AreEqual(v.Memo, o.DbRecord.Memo); Assert.AreEqual(v.Payee, o.DbRecord.Payee); Assert.AreEqual(v.PayeeAccountNumber, o.DbRecord.PayeeAccountNumber); Assert.AreEqual(v.Payer, o.DbRecord.Payer); Assert.AreEqual(v.PayerAccountNumber, o.DbRecord.PayerAccountNumber); Assert.AreEqual(v.CardAssociationName, o.DbRecord.CardAssociationName); Assert.AreEqual(v.CardNumber, o.DbRecord.CardNumber); Assert.AreEqual(v.DailyWithdrawalLimit, o.DbRecord.DailyWithDrawalLimit); }
public async Task <IActionResult> EditDebitCard(string id) { var payment = await payments.GetObject(id); return(View(PaymentViewModelFactory.Create(payment) as DebitCardViewModel)); }