public ActionResult Delete(int?id) { ShowService service = new ShowService(); ShowDetail show = service.GetShowById(id); return(View(show)); }
public IHttpActionResult Get(int id) { ShowService showService = CreateShowService(); var show = showService.GetShowById(id); return(Ok(show)); }
private void ListItem_Click(object sender, EventArgs e) { Program app = Program.GetInstance(); ShowService showService = app.GetService <ShowService>("shows"); // Get the clicked item ListViewItem item = container.SelectedItems[0]; if (item == null) { GuiHelper.ShowError("Geen item geselecteerd"); return; } // Find the show int id = (int)item.Tag; Show show = showService.GetShowById(id); if (show == null) { GuiHelper.ShowError("Kon geen voorstelling vinden voor dit item"); return; } // Redirect to screen ShowDetail showDetail = app.GetScreen <ShowDetail>("showDetail"); showDetail.SetShow(show); app.ShowScreen(showDetail); }
public ActionResult SellTicket(int?row, int?seat, int?showId) { if (row == 0 || seat == 0 || showId == 0 || row == null || seat == null || showId == null) { TempData["error"] = "invalid row, seat or showid"; return(RedirectToAction("Details", new { id = showId.GetValueOrDefault() })); } var show = showService.GetShowById(showId.GetValueOrDefault()); var ticket = new TicketModel { Row = row.GetValueOrDefault(), Seat = seat.GetValueOrDefault(), Show = show }; ticketService.CreateTicket(ticket); return(RedirectToAction("Details", new { id = show.Id })); }
// GET: Show Details public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ShowService service = new ShowService(); ShowDetail show = service.GetShowById(id); return(View(show)); }
public override bool Validate() { Program app = Program.GetInstance(); ShowService showService = app.GetService <ShowService>("shows"); UserService userService = app.GetService <UserService>("users"); ChairService chairService = app.GetService <ChairService>("chairs"); ReservationService reservationService = app.GetService <ReservationService>("reservations"); // Make sure the show exists Show show = showService.GetShowById(showId); if (show == null) { AddError("showId", "Ongeldige voorstelling"); return(false); } // Make sure the user exists User user = userService.GetUserById(userId); if (user == null) { AddError("userId", "Ongeldige gebruiker"); return(false); } // Make sure the chair exists Chair chair = chairService.GetChairById(chairId); if (chair == null) { AddError("chairId", "Ongeldige stoel"); return(false); } // Make sure the chair belongs to this room if (chair.roomId != show.roomId) { AddError("chairId", "De gekozen stoel hoort niet bij de gekozen zaal"); return(false); } // Make sure the chair hasn't been taken if (reservationService.IsChairTaken(chair, show)) { AddError("chairId", "De gekozen stoel is niet beschikbaar"); return(false); } return(true); }
void ShowButton_Click(object sender, EventArgs e, int showId) { Program app = Program.GetInstance(); ShowService showService = app.GetService <ShowService>("shows"); // Get show Show show = showService.GetShowById(showId); // Redirect to screen ReservationCreate reservationScreen = app.GetScreen <ReservationCreate>("reservationCreate"); reservationScreen.SetShow(show); app.ShowScreen(reservationScreen); }
// GET: Edit Movie public ActionResult Edit(int?id) { ShowService service = new ShowService(); ShowDetail detail = service.GetShowById(id); ShowEdit show = new ShowEdit() { Id = detail.Id, Title = detail.Title, Description = detail.Description, PosterUrl = detail.PosterUrl, NextReleaseDate = detail.NextReleaseDate, Franchise = detail.Franchise, AnticipationValue = detail.AnticipationValue }; return(View(show)); }
public async Task <IActionResult> GetShow(Guid id) { var show = await _service.GetShowById(id); return(Ok(show)); }
// Returns the show public Show GetShow() { ShowService showService = Program.GetInstance().GetService <ShowService>("shows"); return(showService.GetShowById(showId)); }
public ActionResult EditShow(int id) { return(View(showService.GetShowById(id))); }