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

            oldFilm = film;
            context.SaveChanges();
        }
コード例 #2
0
ファイル: BookingService.cs プロジェクト: TMaj/BlueCinema
        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();
        }