Esempio n. 1
0
        public ActionResult CreateOrderByUser(int idPayment)
        {
            var idPackageVip  = (int)TempData["PackageVipId"];
            var idPaymentGate = idPayment;
            var useData       = (UserDTO)Session[Common.CommonConstants.USER_SESSION];
            var packageVip    = ApiService.GetAllPackageVip().SingleOrDefault(x => x.ID == idPackageVip);

            if (idPaymentGate == 1)
            {
                // var packageVip = ApiService.GetAllPackageVip().SingleOrDefault(x => x.ID == idPackageVip);

                if (packageVip != null)
                {
                    var link = new MomoService().SetOrderByMomo(Guid.NewGuid(), packageVip.PVipPrice, packageVip.ID, idPaymentGate, useData.UserEmail);
                    return(Redirect(link.ToString()));
                }
                else
                {
                    SetAlert("Mua gói vip không thành công", "error");
                    return(RedirectToAction("Index"));
                }
            }
            else
            {
                Session["ordervip"] = new OrderVipDTO()
                {
                    PVipID    = idPackageVip,
                    PaymentID = idPayment,
                    UserID    = useData.ID,
                    OrdPrice  = packageVip.PVipPrice
                };
                return(RedirectToAction("PaymentWithPaypal", "Payment"));
            }
        }
Esempio n. 2
0
 public ActionResult MomoWithPayment()
 {
     if (Session["id"] != null)
     {
         HttpResponseMessage resPvip = APIService.client.GetAsync("PVip/" + (int)Session["id"]).Result;
         var modelPVip = resPvip.Content.ReadAsAsync <PackageVipView>().Result;
         var link      = new MomoService().CreateOrderByMomo(Guid.NewGuid(), modelPVip.PVipPrice);
         return(Redirect(link.ToString()));
     }
     return(RedirectToAction("BuyVip", "Client"));
 }