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()); }
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()); }