public ActionResult ToSelf(DebitCardDetail debitCardDetail) { string ToDebitCardNumber = (string)TempData.Peek("CardNo"); try { string SenderPhoneNumber = TempData.Peek("PhoneNumber").ToString(); var FromDebitCardDetails = context.CustomerBankDetailsConfidentials.Single(FetchDetails => FetchDetails.CardNumber == debitCardDetail.DebitCardNumber && FetchDetails.CVV == debitCardDetail.CVV); double PresentBalance = Convert.ToDouble(FromDebitCardDetails.Balance); string currenttime = DateTime.Now.ToString("yyyy/MM/dd"); string expiredate = FromDebitCardDetails.ValidUpto.ToString("yyyy/MM/dd"); DateTime current, expiry; var UPIDetailsofSender = context.UPIs.Single(FetchDetails => FetchDetails.PhoneNumber == SenderPhoneNumber); if (UPIDetailsofSender.UPIPin == null) { return(RedirectToAction("CreateUPIPin", "Home")); } else if (debitCardDetail.DebitCardNumber == ToDebitCardNumber) { ViewBag.Message = "Please choose different card."; } else if (debitCardDetail.Amount > PresentBalance) { ViewBag.Message = "Insufficient Balance."; } else if (debitCardDetail.Amount > 20000) { ViewBag.Message = "Cannot transfer more than Rs.20000."; } else if (DateTime.TryParse(currenttime, out current) && DateTime.TryParse(expiredate, out expiry)) { if (current.Date > expiry.Date) { ViewBag.Message = "Card expired."; } else if (current.Date <= expiry.Date) { TempData["FromDebitCardNumber"] = FromDebitCardDetails.CardNumber; TempData["FromCVV"] = FromDebitCardDetails.CVV; TempData["AmountToTransferForSelf"] = debitCardDetail.Amount; return(RedirectToAction("ValidateUPIPINForSelf", "Home")); } else { ViewBag.Message = "Contact your bank."; } } else { ViewBag.Message = "Contact your bank."; } } catch (Exception) { ViewBag.Message = "Invalid Details."; } return(View()); }
public ActionResult ToContact(DebitCardDetail debitCardDetails) { string SenderPhoneNumber = (string)TempData.Peek("PhoneNumber"); try { var FetchedUserDetails = context.CustomerBankDetailsConfidentials.Single(FetchPhoneNumber => FetchPhoneNumber.PhoneNumber == SenderPhoneNumber); var UPIDetailsofSender = context.UPIs.Single(FetchDetails => FetchDetails.PhoneNumber == SenderPhoneNumber); double PresentBalance = Convert.ToDouble(FetchedUserDetails.Balance); if (UPIDetailsofSender.UPIPin == " ") { return(RedirectToAction("CreateUPIPin", "Home")); } else { if (FetchedUserDetails.PhoneNumber == debitCardDetails.PhoneNumber) { ViewBag.Message = "Cannot transfer to self."; } else if (debitCardDetails.Amount > PresentBalance) { ViewBag.Message = "Insufficient balance."; } else if (debitCardDetails.Amount > 20000) { ViewBag.Message = "Cannot transfer more than Rs.20000."; } else { TempData["ToContactValidation"] = debitCardDetails.PhoneNumber; TempData["AmountToTransfer"] = debitCardDetails.Amount; return(RedirectToAction("ValidateUPIPINForContact")); } } } catch (Exception e) { ViewBag.Message = e; //ViewBag.Message = "Receiver is not on platform."; } return(View()); }