示例#1
0
 public ActionResult Index(PaymentModel paymentModel)
 {
     if (ModelState.IsValid)
     {
         var bookingId = 0;
         using (var context = new GoExploreEntities()) //need to maintain transaction here
         {
             Booking booking = new Booking();
             booking.bookingDate   = DateTime.Now;
             booking.eventId       = paymentModel.EventId;
             booking.address       = paymentModel.Address;
             booking.bookingStatus = "S";
             booking.city          = paymentModel.City;
             booking.country       = paymentModel.Country;
             booking.seatsOccupied = paymentModel.SeatsOccupied;
             booking.state         = paymentModel.State;
             booking.status        = "S";
             booking.totalAmount   = paymentModel.TotalAmount;
             booking.userId        = Convert.ToInt32(Session["UserId"]);
             booking.zipCode       = paymentModel.ZipCode;
             db.Bookings.Add(booking);
             db.SaveChanges();
             Payment payment = new Payment();
             payment.bookingId   = booking.bookingId;
             payment.amount      = paymentModel.TotalAmount;
             payment.cardNumer   = paymentModel.CardNumber;
             payment.cardType    = paymentModel.CardType;
             payment.cvv         = paymentModel.CVV;
             payment.expiryDate  = paymentModel.ExpiryMonth + "/" + paymentModel.ExpiryYear.ToString();
             payment.firstName   = paymentModel.NameOnCard;
             payment.lastName    = "";
             payment.paymentMode = paymentModel.CardType;
             payment.status      = "S";
             db.Payments.Add(payment);
             db.SaveChanges();
             bookingId = booking.bookingId;
         }
         ViewBag.result    = "Success";
         ViewBag.bookingId = bookingId;
         return(View());
     }
     else
     {
         //string json = JsonConvert.SerializeObject(paymentModel);
         //var encryptedData = Utility.Encrypt(json, "GoExploreHashKey");
         paymentModel.Amount = paymentModel.TotalAmount;
         ViewBag.BookingId   = 0;
         return(View(paymentModel));
     }
 }
示例#2
0
        public ActionResult SaveEvent(Event_Details event_Details, HttpPostedFileBase ImagePath)
        {
            var allowedExtensions = new[] { ".Jpg", ".png", ".jpg", "jpeg" };

            using (GoExploreEntities goExplore = new GoExploreEntities()) {
                int _rownumner = goExplore.Event_Details.Count();

                var fileName = Path.GetFileName(ImagePath.FileName);
                var ext      = Path.GetExtension(ImagePath.FileName);

                string name = Path.GetFileNameWithoutExtension(fileName);
                //string myfile = name +"_"+ _rownumner.ToString() + ext;
                string myfile = "eImg_" + _rownumner.ToString() + ext;
                var    path   = Path.Combine(Server.MapPath("~/images/"), myfile);
                ImagePath.SaveAs(path);

                Event_Details _event_Details = new Event_Details();
                _event_Details.categoryId       = event_Details.categoryId;
                _event_Details.eventName        = event_Details.eventName;
                _event_Details.eventDescription = event_Details.eventDescription;
                _event_Details.eventDate        = event_Details.eventDate;
                _event_Details.venue            = event_Details.venue;
                _event_Details.organizerId      = event_Details.organizerId;
                //_event_Details.i = myfile;

                goExplore.Event_Details.Add(_event_Details);
                goExplore.SaveChanges();

                int newEventId = event_Details.eventId;
                return(RedirectToAction("Index", "Dashboard", new { @pageNo = 0 }));
            }
        }
示例#3
0
 public ActionResult CancelOrder(int bookingId)
 {
     using (GoExploreEntities db = new GoExploreEntities())
     {
         var booking = db.Bookings.Where(i => i.bookingId == bookingId).FirstOrDefault();
         booking.status = "D";
         //db.Bookings.Add(booking);
         db.SaveChanges();
         ViewBag.Success = 1;
         return(RedirectToAction("OrderHistory", "User"));
     }
 }
示例#4
0
 public int Createuser(RegistrationModel registrationModel)
 {
     using (GoExploreEntities goExplore = new GoExploreEntities())
     {
         int  UID      = 0;
         User existing = goExplore.Users.FirstOrDefault(u => u.emailId == registrationModel.EmailId);
         if (existing == null)
         {
             User users = new User();
             users.userid   = 0;
             users.userName = registrationModel.UserName;
             users.emailId  = registrationModel.EmailId;
             users.userType = registrationModel.UserType;
             users.password = registrationModel.Password;
             goExplore.Users.Add(users);
             UID = goExplore.SaveChanges();
         }
         else
         {
             UID = -1;
         }
         return(UID);
     }
 }