public ActionResult Order(PagePlusActivityPlusOrderDinners model) { Order order = (Order)Session["order"]; if (order == null) { order = new Order(); } DateTime startTime = model.Day.Date + model.Time.TimeOfDay; Activity activity = activityRepository.GetActivity(model.Activity.Id, (Language)Session["language"]); OrderHasTickets ticketOrder = new OrderHasTickets(); ticketOrder.Ticket_TimeSlot_Activity_Id = model.Activity.Id; ticketOrder.Remarks = model.Order.OrderHasTickets[0].Remarks; ticketOrder.Ticket_TimeSlot_StartTime = model.Day.Date + model.Time.TimeOfDay; ticketOrder.Ticket_Type = TicketType.Single; ticketOrder.Amount = model.NumberOfAdults; ticketOrder.Ticket = ticketRepository.GetTicket(activity, startTime, ticketOrder.Ticket_Type); ticketOrder.TotalPrice = model.NumberOfAdults * ticketOrder.Ticket.Price; order.OrderHasTickets.Add(ticketOrder); if (model.NumberOfKids > 0) { OrderHasTickets to = new OrderHasTickets(); to.Ticket_TimeSlot_Activity_Id = model.Activity.Id; to.Remarks = model.Order.OrderHasTickets[0].Remarks; to.Ticket_TimeSlot_StartTime = model.Day.Date + model.Time.TimeOfDay; to.Ticket_Type = TicketType.Child; to.Amount = model.NumberOfKids; to.Ticket = ticketRepository.GetTicket(activity, startTime, to.Ticket_Type); to.TotalPrice = model.NumberOfKids * ticketOrder.Ticket.Price; order.OrderHasTickets.Add(to); } Session["order"] = order; BasketHelper.getInstance().checkBasket(HttpContext); return(Redirect(ControllerContext.HttpContext.Request.UrlReferrer.ToString())); }
public ActionResult OrderJazz(int id, int aantal) { Language language = (Language)Session["language"]; Activity activity = activityRepository.GetActivity(id, language); OrderHasTickets ticketOrder = new OrderHasTickets(); ticketOrder.Ticket_TimeSlot_Activity_Id = activity.Id; ticketOrder.Ticket_TimeSlot_StartTime = activity.Timeslots[0].StartTime; ticketOrder.Ticket_Type = activity.Timeslots[0].Tickets[0].Type; ticketOrder.Amount = aantal; ticketOrder.Ticket = activity.Timeslots[0].Tickets[0]; ticketOrder.TotalPrice = aantal * activity.Timeslots[0].Tickets[0].Price; Order order = (Order)Session["order"]; if (order == null) { order = new Order(); order.OrderHasTickets.Add(ticketOrder); } else { OrderHasTickets OHT = order.OrderHasTickets.Where(x => x.Ticket_TimeSlot_Activity_Id == ticketOrder.Ticket_TimeSlot_Activity_Id).SingleOrDefault(); if (OHT != null) { OHT.Amount += ticketOrder.Amount; OHT.TotalPrice = OHT.Ticket.Price * OHT.Amount; } else { order.OrderHasTickets.Add(ticketOrder); } } Session["order"] = order; BasketHelper.getInstance().checkBasket(HttpContext); return(Redirect(ControllerContext.HttpContext.Request.UrlReferrer.ToString())); }