コード例 #1
0
ファイル: Payment.cs プロジェクト: s-leonard/Tarts
 public Payment(Booking booking, decimal amount, string reference)
 {
     Booking = booking;
     Amount = amount;
     Reference = reference;
     Status = PaymentStatus.Created;
     Created = DateTime.Now;
 }
コード例 #2
0
ファイル: BookingController.cs プロジェクト: s-leonard/Tarts
        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));
        }
コード例 #3
0
ファイル: BookingController.cs プロジェクト: s-leonard/Tarts
 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));
 }
コード例 #4
0
ファイル: BookingController.cs プロジェクト: s-leonard/Tarts
        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});
        }