public ActionResult AddPay(PaymentViewModel pay) { var paymentMethod = _Context.PaymentMethods.SingleOrDefault(p => p.Id == pay.PaymentId); var agentNumber = ""; if (paymentMethod.Name == "bKash") { agentNumber = "01775203399"; } else if (paymentMethod.Name == "Dutch Bangla") { agentNumber = "017752033990"; } var payView = new StorePaymentViewModel() { AgentNumber = agentNumber }; return(View(payView)); }
public ActionResult StorePayment(StorePaymentViewModel sp) { if (!ModelState.IsValid) { return(View("AddPay", sp)); } var checkAddKey = _Context.Advertisements.SingleOrDefault(a => a.Key == sp.AddKey); if (checkAddKey == null) { ModelState.AddModelError("AddKey", "Key is not valid"); return(View("AddPay", sp)); } ConfirmPayment cp = new ConfirmPayment(); cp.AddKey = sp.AddKey; cp.Mobile = sp.Mobile; cp.TransactionId = sp.TransactionId; _Context.ConfirmPayments.Add(cp); _Context.SaveChanges(); return(RedirectToAction("Index", "Users")); }