예제 #1
0
        public string CreateBooking(string name)
        {
            using (var db = new CinemaNewDB())
            {
                db.UserBookings.Add(new UserBookings()
                {
                    Name = name,
                });

                db.SaveChanges();
            }
            return(null);
        }
예제 #2
0
        public UserBookings CancelBooking(string name)
        {
            using (var db = new CinemaNewDB())
            {
                var booking = db.UserBookings.FirstOrDefault(b => b.Name.ToLower() == name.ToLower());
                if (booking != null)
                {
                    db.UserBookings.Remove(booking);

                    db.SaveChanges();

                    return(booking);
                }
            }

            return(null);
        }