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());
     }
 }
Beispiel #2
0
        public IHttpActionResult GetVoucherModel(int id)
        {
            VoucherModel voucherModel = voucherService.GetVoucher(id);

            if (voucherModel == null)
            {
                return(NotFound());
            }

            return(Ok(voucherModel));
        }
Beispiel #3
0
 public JsonResult getVoucherById(long id)
 {
     return(Json(VoucherService.GetVoucher(id), JsonRequestBehavior.AllowGet));
 }