Пример #1
0
        // GET: TripNetworks/Create
        public ActionResult RequestToJoin(int?id, string payRef)
        {
            //          var testOrLiveSecret = ConfigurationManager.AppSettings["PayStackSecret"];
            //          var api = new PayStackApi(testOrLiveSecret);
            //          // Initializing a transaction
            //          var response = api.Transactions.Initialize("*****@*****.**", 5000000);
            //          if (response.Status)
            //          {

            //          }
            //// use response.Data
            //          else
            //          {

            //          }
            // show response.Message



            string      currentUser = User.Identity.GetUserId();
            TripNetwork tripNetwork = new TripNetwork()
            {
                TripsId = id, TripMembers = currentUser, PaymentReference = payRef, DatePaid = DateTime.Now, Paid = true
            };

            DAL.TripNetwk dt = new DAL.TripNetwk();
            var           returnedElement = dt.CreateTripNetwork(tripNetwork);

            //var tripnetworkbyId = db.TripNetworks.Where(y => y.TripsId == id);
            //RedirectToAction("RequestToJoin", new { id = id });
            return(RedirectToAction("IndexById", new { id = id }));
            //return View("Index", tripnetworkbyId);
        }
Пример #2
0
        public ActionResult Create([Bind(Include = "Id,TripsId,TripMembers,DateAdded,ActiveStatus,DateModified")] TripNetwork tripNetwork)
        {
            if (ModelState.IsValid)
            {
                string currentUser = User.Identity.GetUserId();
                tripNetwork.TripMembers = currentUser;
                DAL.TripNetwk dt = new DAL.TripNetwk();
                TempData["AlertMessage"] = dt.CreateTripNetwork(tripNetwork);
                //db.TripNetworks.Add(tripNetwork);
                //db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.TripMembers = new SelectList(db.AspNetUsers, "Id", "Email", tripNetwork.TripMembers);
            return(View(tripNetwork));
        }