Example #1
0
 public Payment(Booking booking, decimal amount, string reference)
 {
     Booking = booking;
     Amount = amount;
     Reference = reference;
     Status = PaymentStatus.Created;
     Created = DateTime.Now;
 }
Example #2
0
        public ActionResult CustomerAccount(string eventName, int ticketID)
        {
            Ticket = Repo.GetById<Ticket>(ticketID);
            if((Ticket == null) || (Ticket.Remaining < 1))
                return RedirectToAction("SoldOut");

            GetCustomerViaFacebook();
            if (ViewBag.Customer != null)
            {
                var booking = new Booking(ViewBag.Customer, Ticket, 1);
                Repo.Save(booking);
                return RedirectToAction("ReservationSummary", new { id = booking.ID });
            }

            return View(new CreateCustomerViewModel(Ticket));
        }
Example #3
0
 public ActionResult AccountLogin(CustomerLoginPostModel model)
 {
     Ticket = Repo.GetById<Ticket>(model.ticketID);
     if ((Ticket == null) || (Ticket.Remaining < 1))
         return RedirectToAction("SoldOut");
     var existing = Repo.GetByFieldName<Customer>("Email", model.Email);
     if (existing != null)
     {
         if (existing.Password.Decrypt() == model.Password)
         {
             AddCustomerLoginCookie(existing);
             var booking = new Booking(existing, Ticket, 1);
             Repo.Save(booking);
             return RedirectToAction("ReservationSummary", new { id = booking.ID });
         }
         ViewBag.ErrorMessage = "Login Failed";
     }
     else
         ViewBag.ErrorMessage = "No customer account was found for that email address";
     return View(new CreateCustomerViewModel(Ticket));
 }
Example #4
0
        public ActionResult CustomerAccount(CreateCustomerPostModel model)
        {
            Ticket = Repo.GetById<Ticket>(model.ticketID);
            if ((Ticket == null) || (Ticket.Remaining < 1)) return RedirectToAction("SoldOut");

            var existing = Repo.GetByFieldName<Customer>("Email", model.Email);
            if (existing != null)
            {
                ViewBag.ErrorMessage = "A user already exists with that email address";
                return View(new CreateCustomerViewModel(Ticket,model));
            }

            var cust = new Customer(model.Email, model.FirstName, model.Surname, model.Password);
            var valid = cust.Validate();
            if(!valid.Succeeded)
            {
                ViewBag.ErrorMessage =  valid.Message;
                return View(new CreateCustomerViewModel(Ticket, model));
            }
            Repo.Save(cust);
            var booking = new Booking(cust, Ticket, 1);
            Repo.Save(booking);
            return RedirectToAction("ReservationSummary", new {id=booking.ID});
        }