// GET: Amenitites/Create
        public ActionResult Create(string id)
        {
            if (id == null)
            {
                return(RedirectToAction("Index"));
            }

            Guest guest = new Guest();

            try
            {
                string email = User.Identity.Name;
                guest = _guestManager.RetrieveGuestByEmail(email);
            }
            catch
            {
                return(RedirectToAction("Login", "Account"));
            }

            AppointmentModel appt = new AppointmentModel()
            {
                AppointmentType = id,
                Description     = "Incomplete",
                StartDate       = DateTime.Now
            };

            ViewBag.Times = _times;
            return(View(appt));
        }
        // GET: MyAccount
        public ActionResult Index()
        {
            try
            {
                Guest guest = new Guest();

                string email = User.Identity.Name;
                guest = _guestManager.RetrieveGuestByEmail(email);

                return(View(guest));
            }
            catch
            {
                RedirectToAction("Index", "Home");
            }
            return(View());
        }
        // GET: Event/Buy
        public ActionResult Buy(int id)
        {
            Guest guest    = new Guest();
            Event theEvent = null;

            try
            {
                string email = User.Identity.Name;
                guest = _guestManager.RetrieveGuestByEmail(email);
            }
            catch
            {
                return(RedirectToAction("Login", "Account"));
            }
            try
            {
                theEvent = eventManager.RetrieveEventByID(id);
            }
            catch (Exception ex)
            {
                TempData["error"] = new ErrorViewModel(
                    Title: "Events",
                    Message: "We could not purhcase your ticket at this time ",
                    ExceptionMessage: ex.Message,
                    ButtonMessage: "Try again",
                    ReturnController: "Event",
                    ReturnAction: "Index"
                    );

                return(RedirectToAction("Index", "Error"));
            }
            BuyTicketModel ticket = new BuyTicketModel()
            {
                EventID    = id,
                EventTitle = theEvent.EventTitle,
                Price      = theEvent.Price,
                Quantity   = 0,
                OfferingID = theEvent.OfferingID,
                Date       = theEvent.EventStartDate
            };

            return(View(ticket));
        }
예제 #4
0
        public ActionResult Create(int id, DateTime start, DateTime end, int numGuest)
        {
            _types = _roomType.RetrieveAllRoomTypes();
            if (id == 0)
            {
                return(RedirectToAction("Index"));
            }
            Room  room  = null;
            Guest guest = new Guest();

            try
            {
                room = roomManager.RetreieveRoomByID(id);
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
            try
            {
                string email = User.Identity.Name;
                guest = _guestManager.RetrieveGuestByEmail(email);
            }
            catch
            {
                return(RedirectToAction("Login", "Account"));
            }


            NewReservation res = new NewReservation()
            {
                ArrivalDate    = start,
                DepartureDate  = end,
                NumberOfGuests = numGuest,
                numberOfPets   = 0,
                RoomType       = room.RoomType,
                Notes          = ""
            };

            ViewBag.Types = _types;
            return(View(res));
        }