public ActionResult PaymentConfirmation(FormCollection form, PaymentConfirmationViewModel model) { if (ModelState.IsValid) { bool paymentConfirmationIsValid = orderProvider.ValidateOrderPayment( model.OrderNo, model.PayAmount); if (paymentConfirmationIsValid) { if (!orderProvider.IsOrderPaymentConfirmed(model.OrderNo)) { orderProvider.CreatePaymentConfirmation(model.OrderNo, model.BankId, 2, model.PaymentDate, model.SenderName, model.PayAmount, null); string encryptedOrderNo = RijndaelHelper.Encrypt(model.OrderNo, CryptographyKey); return(RedirectToAction("PaymentConfirmationSuccess", new { token = encryptedOrderNo })); } ModelState.AddModelError(String.Empty, String.Format("Payment confirmation for order {0} has been created already.", model.OrderNo)); return(RedirectToAction("PaymentConfirmation")); } ModelState.AddModelError(String.Empty, String.Format("Invalid Payment for Order {0}", model.OrderNo)); return(RedirectToAction("PaymentConfirmation")); } return(View(model)); }