public ActionResult CreateBookingCheck(int id, DateTime BDate) { EscapeRoomService escs = new EscapeRoomService(); EscRef.EscapeRoom es = escs.GetEscapeRoom(id); ViewBag.EscapeRoom = es; List <TimeSpan> freetime = escs.FreeTimes(id, BDate); if (BDate == null) { TempData["message"] = "Der er ikke valgt en dato"; return(RedirectToAction("CreateBooking", new { id = id })); } else if (freetime.Count == 0) { TempData["message"] = "Der ingen tilgængelige booking tider"; return(RedirectToAction("CreateBooking", new { id = id })); } else { ViewBag.freetimes = freetime; ViewBag.ChosenDate = BDate.ToString("dd-MM-yyyy"); } return(View()); }
/// <summary> /// Gets an escaperoom /// </summary> /// <param name="id">The EscapeRoom ID</param> /// <returns>returns the View GetEscapeRoom</returns> public ActionResult GetEscapeRoom(int id) { EscapeRoomService ecss = new EscapeRoomService(); EscRef.EscapeRoom escr = ecss.GetEscapeRoom(id); ViewBag.Escaperoom1 = escr; return(View()); }
/// <summary> /// Starts the booking by getting the escaperoom with the id /// </summary> /// <param name="id">The EscapeRoom ID</param> /// <returns>Returns the view CreateBooking if customer is logged in and redirects to login if not</returns> public ActionResult CreateBooking(int id) { EscapeRoomService escs = new EscapeRoomService(); EscRef.EscapeRoom es = escs.GetEscapeRoom(id); ViewBag.TimeList = es.AvalibleTimes; ViewBag.EscapeRoom = es; HttpCookie cookie = Request.Cookies["User"]; if (cookie == null) { return(RedirectToAction("Login", "Customer")); } return(View()); }
public ActionResult CreateBookingDone(int EmployeeID, string username, int escapeRoomID, TimeSpan BookTime, int AmountOfPeople, DateTime BDate) { EscapeRoomService escs = new EscapeRoomService(); EscRef.EscapeRoom es = escs.GetEscapeRoom(escapeRoomID); ViewBag.EscapeRoom = es; List <TimeSpan> freetime = escs.FreeTimes(escapeRoomID, BDate); ViewBag.freetimes = freetime; BookingService bs = new BookingService(); HttpCookie cookie = Request.Cookies["User"]; cookie.Value = username; int c = bs.CreateBooking(EmployeeID, username, escapeRoomID, BookTime, AmountOfPeople, BDate); if (c == 0) { TempData["message"] = "Den tid du prøvede at booke er desværre blevet taget "; return(RedirectToAction("CreateBooking", new { id = escapeRoomID })); } return(View()); }