Beispiel #1
0
        public void Update(Film film)
        {
            var oldFilm = context.Films.FirstOrDefault(f => f.Id == film.Id);

            oldFilm = film;
            context.SaveChanges();
        }
Beispiel #2
0
        public void Add(Booking booking)
        {
            var seance = this.context.Seances.Include(s => s.Film)
                         .Include(s => s.Bookings)
                         .Include(s => s.Room)
                         .ToList().FirstOrDefault(s => s.Id.Equals(booking.Seance.Id));

            booking.Seance = seance ?? throw new BookingException("Invalid seance id");

            ValidateBooking(booking);

            booking.BookingTime = DateTime.Now;

            context.Bookings.Add(booking);
            context.SaveChanges();
        }