public IActionResult Index(int id) { Tbl_pay A = new Tbl_pay() { Phone = User.Identity.GetId(), Pay = id, Paytime = DateTime.UtcNow }; db.Tbl_pays.Add(A); db.SaveChanges(); return(RedirectToAction("Request")); }
public IActionResult paytravel() { var qtravel = db.tbl_Travels.Where(a => a.UserPhone == User.Identity.GetId() && a.TypePay == "پذیرش").SingleOrDefault(); if (qtravel != null) { if (Convert.ToInt32(HttpContext.Session.GetString("pay")) >= Convert.ToInt32(qtravel.Price)) { Tbl_pay A = new Tbl_pay() { Phone = User.Identity.GetId(), Harvest = Convert.ToInt32(qtravel.Price), havesttime = DateTime.UtcNow, idtravel = qtravel.Id }; db.Tbl_pays.Add(A); db.SaveChanges(); var quser = db.tbl_Users.Where(a => a.phone == qtravel.UserPhone)?.SingleOrDefault(); Tbl_paydriver B = new Tbl_paydriver() { Driverid = qtravel.DriverId.ToString(), Pay = Convert.ToInt32(qtravel.Price), Paytime = DateTime.UtcNow, Travelid = qtravel.Id.ToString(), NameFamily = quser.NameFamily }; db.Tbl_paydriver.Add(B); db.SaveChanges(); HttpContext.Session.SetString("pay", Diposit().ToString()); return(RedirectToAction("mapaccept", "mapaccept")); } else { msg = "اعتبار شما کافی نیست لطفا کیف پول خو را شارژ کنید"; return(RedirectToAction("pay")); } } return(RedirectToAction("mapaccept", "mapaccept")); }