public bool RemoveReservation(int orderId) { try { using (CarRentEntities db = new CarRentEntities()) { orders_tbl res = db.orders_tbl.FirstOrDefault(r => r.OrderId == orderId); if (res != null && res.PickUpDate < (new DateTime().ToLocalTime())) { db.orders_tbl.Remove(res); db.SaveChanges(); return(true); } return(false); } } catch (Exception) { return(false); } }
public bool EditReservation(Reservation changedRes) { try { using (CarRentEntities db = new CarRentEntities()) { orders_tbl res = db.orders_tbl.FirstOrDefault(r => r.OrderId == changedRes.OrderId); if (res != null) { changedRes.ReturnDate = res.ReturnDate; changedRes.ActuallReturnDate = res.ActuallReturnDate; db.SaveChanges(); return(true); } return(false); } } catch (Exception) { return(false); } }