public ActionResult ConfirmVoucher(ConfirmVoucherViewModel confirmVoucher) { try { if (!string.IsNullOrEmpty(confirmVoucher.VoucherToken)) { var voucherDetail = _voucherService.GetVoucher(confirmVoucher.VoucherToken).Result; var model = new VoucherDetailViewModel { VoucherToken = voucherDetail.voucherToken, VoucherDescription = voucherDetail.voucherDescription, Name = voucherDetail.name, VoucherPurchasedOn = voucherDetail.voucherPurchasedOn, UsedOn = voucherDetail.usedOn }; _voucherDetailViewModel = model; return(RedirectToAction("DisplayVoucher")); } else { ModelState.AddModelError("", "there is a problem with this operation."); return(View()); } } catch (Exception) { ModelState.AddModelError("", "This operation could not be completed, please try again."); return(View()); } }
public ActionResult ConfirmVoucher() { var model = new ConfirmVoucherViewModel(); return(View(model)); }