public string CreateBooking(string name) { using (var db = new CinemaNewDB()) { db.UserBookings.Add(new UserBookings() { Name = name, }); db.SaveChanges(); } return(null); }
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); }