public bool DeleteOfferRides(string offerId) { try { var bookings = GetOfferBookings(offerId); foreach (var bookingView in bookings) { var booking = _context.Bookings.Where(s => s.RentalOfferID == bookingView.RentalOfferID).FirstOrDefault(); _context.Remove(booking); _context.SaveChanges(); } return(true); } catch (Exception e) { return(false); } }
public bool DeleteRatingById(string id) { try { var rating = _context.Ratings.Where(s => s.BookingID == id).FirstOrDefault(); _context.Remove(rating); _context.SaveChanges(); return(true); } catch (Exception e) { return(false); } }
public bool RemoveRentalOffer(string rentalOfferId) { try { var rentalOffer = _context.RentalOffers.Where(s => s.RentalOfferID == rentalOfferId).FirstOrDefault(); _context.Remove(rentalOffer); _context.SaveChanges(); var IsSucess = bookingRequest.DeleteOfferRides(rentalOfferId); return(IsSucess); } catch (Exception e) { return(false); } }