public void CancelReservation(Guid reservationId) { // - remove reservation from the reservedInventory // - update inventory var reservation = _reservationsProvider.GetReservations().FirstOrDefault(r => r.Id == reservationId); if (reservation != null) { _reservationsProvider.TryRemoveReservation(reservationId); // get the product id in order to update inventory. _stocksProvider.TryIncreaseStock(reservation.ProductId, 1); } }
public void UponExpiredReservations(List <Reservation> reservations) { foreach (var reservation in reservations) { _reservationsProvider.TryRemoveReservation(reservation.Id); } }