public Booking(Customer customer, Ticket ticket, int quantity) { Created = DateTime.Now; Status = BookingStatus.Reservation; Quantity = (quantity > 0) ? quantity : 1; Customer = customer; Ticket = ticket; TicketPrice = Ticket.Price; Event = Ticket.Event; Reference = GenerateUniqueReference(); BookingFee = ticket.BookingFee; Payments = new List<Payment>(); }
public CreateCustomerViewModel(Ticket ticket = null, CreateCustomerPostModel postModel = null) { if (ticket != null) { EventName = ticket.Event.Name; EventSlug = ticket.Event.Slug; TicketID = ticket.ID; TicketName = ticket.Name; } if(postModel != null) { FirstName = postModel.FirstName; Surname = postModel.Surname; Email = postModel.Email; } }
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)); }
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)); }
public virtual ReturnValue UpdateTicketInfo(Ticket ticket, string name, decimal price, decimal bookingFee, int allocation, bool enabled) { var retVal = ticket.UpdateTicketInfo(name, price, bookingFee, allocation, enabled); ReCalculateTicketTotals(); return retVal; }
public virtual void RemoveTicket(Ticket ticket) { if (Tickets.Contains(ticket)) { if (ticket.Sold == 0) Tickets.Remove(ticket); else ticket.Disable(); } }
public virtual void EnableTicket(Ticket ticket) { ticket.Enable(); ReCalculateTicketTotals(); }
public virtual Ticket AddTicket(string name, decimal price) { var ticket =new Ticket() {Name=name, Price=price}; if (!Tickets.Contains(ticket)) Tickets.Add(ticket); ReCalculateTicketTotals(); return ticket; }
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}); }