protected override EventHandler GetHandler()
    {
        var mongoClient = new MongoClient("mongodb://localhost");

        _repository = new MongoDbAvailableSlotsRepository(mongoClient.GetDatabase(Guid.NewGuid().ToString()));
        return(new AvailableSlotsProjection(_repository));
    }
Example #2
0
    public AvailableSlotsProjection(MongoDbAvailableSlotsRepository availableSlotsRepository)
    {
        When <SlotScheduled>((e, m) =>
                             availableSlotsRepository.AddSlot(new MongoDbAvailableSlot(
                                                                  e.SlotId.ToString(),
                                                                  e.DayId,
                                                                  e.SlotStartTime.ToString("dd-MM-yyyy"),
                                                                  e.SlotStartTime.ToString("h:mm tt"),
                                                                  e.SlotDuration,
                                                                  false
                                                                  )));

        When <SlotBooked>((e, m) =>
                          availableSlotsRepository.HideSlot(e.SlotId));

        When <SlotBookingCancelled>((e, m) =>
                                    availableSlotsRepository.ShowSlot(e.SlotId));

        When <SlotScheduleCancelled>((e, m) =>
                                     availableSlotsRepository.DeleteSlot(e.SlotId));
    }