Esempio n. 1
0
        public IActionResult OnPostRemoveBooking(int concertId, int participantId)
        {
            Concert concert = FestivalManager.Calendar.GetConcert(concertId);
            Booking booking = concert.Bookings.Find(b => b.Participant?.ID == participantId);

            concert.RemoveBooking(booking);
            return(RedirectToPage("./ParticipantPage", new { id = participantId }));
        }
Esempio n. 2
0
        public IActionResult OnPostRemoveBooking(int id)
        {
            var claimTicketID = HttpContext.User.Claims.Where(c => c.Type == "TicketID").Select(t => t.Value).First();

            Concert     c = FestivalManager.Calendar.GetConcert(id);
            Participant p = FestivalManager.GetParticipants().Where(p => p.Ticket?.TicketNumber == claimTicketID).First();

            c.RemoveBooking(p);
            return(RedirectToPage("./ParticipantArtist", new { id = id }));
        }
Esempio n. 3
0
        public void RemoveBooking_RemovesKnownBooking()
        {
            //Arrange
            var     mock       = new Mock <IDataAccess>();
            var     dataAccess = new Mock <IDataAccess>();
            Concert concert    = new Concert(dataAccess.Object);
            Booking booking    = new Booking(mock.Object);
            int     expected   = 0;

            concert.Bookings.Add(booking);

            //Act
            concert.RemoveBooking(booking);
            int result = concert.Bookings.Count;

            //Assert
            Assert.Equal(expected, result);
        }
Esempio n. 4
0
        public void RemoveBooking_DoesNotRemoveBookingNotInBookings()
        {
            //Arrange
            var     mock       = new Mock <IDataAccess>();
            var     dataAccess = new Mock <IDataAccess>();
            Concert concert    = new Concert(dataAccess.Object);
            Booking booking1   = new Booking(mock.Object);
            Booking booking2   = new Booking(mock.Object);
            int     expected   = 1;

            concert.Bookings.Add(booking1);

            //Act
            concert.RemoveBooking(booking2);
            int result = concert.Bookings.Count;

            //Assert
            Assert.Equal(expected, result);
        }