Пример #1
0
        public IActionResult Get(int showingId = 0, bool includeReservations = false)
        {
            IActionResult      foundToReturn;
            Showing            foundShowing;
            List <SeatBooking> seatBookings;

            ShowingDataControl     sControl  = new ShowingDataControl(_configuration);
            SeatBookingDataControl sbControl = new SeatBookingDataControl(_configuration);

            foundShowing = sControl.GetShowingViewById(showingId);
            if (foundShowing != null && includeReservations)
            {
                seatBookings = sbControl.GetSeatBookings(showingId);
                if (seatBookings != null)
                {
                    foundShowing.SeatBookings = seatBookings;
                }
                else
                {
                    foundToReturn = new StatusCodeResult(500);
                }
            }
            if (foundShowing != null)
            {
                foundToReturn = Ok(foundShowing);
            }
            else
            {
                foundToReturn = NotFound();
            }
            return(foundToReturn);
        }
Пример #2
0
        public IActionResult Delete(int showingId)
        {
            IActionResult      foundToReturn;
            ShowingDataControl showingDataControl = new ShowingDataControl(_configuration);
            bool wasOk = showingDataControl.Delete(showingId);

            if (wasOk)
            {
                foundToReturn = Ok();
            }
            else
            {
                foundToReturn = new StatusCodeResult(200);
            }

            return(foundToReturn);
        }
Пример #3
0
 public ShowingsController(IConfiguration inConfiguration)
 {
     _configuration = inConfiguration;
     _sControl      = new ShowingDataControl(_configuration);
 }