public async Task <IEnumerable <BookingRepresentation> > List() { FailRandom(); var bookings = await service.ListPendingAsync(); return(mapper.MapFrom(bookings)); }
public async Task BookAsync(string userId, int accommodationId, BookingDetails details) { var data = mapper.MapFrom(details); var api = await apiClientFactory.CreateApiClientAsync(); var result = await api.CreateBookingWithHttpMessagesAsync(accommodationId, data); if (result.Response.StatusCode == HttpStatusCode.NotFound) { throw new AccommodationNotFoundException(accommodationId); } }
public async Task BookAsync(string userId, int accommodationId, BookingDetails details) { var data = mapper.MapFrom(details); var result = await partitionClientFactory.CreatePartitionClient(new ServicePartitionKey(userId.ToPartitionKey())).InvokeWithRetryAsync(async client => { var api = await client.CreateApiClient(); return(await api.CreateBookingWithHttpMessagesAsync(accommodationId, data)); }); if (result.Response.StatusCode == HttpStatusCode.NotFound) { throw new AccommodationNotFoundException(accommodationId); } }
public Task ApplyAsync(BookFastContext model) { model.Bookings.Add(mapper.MapFrom(booking)); return(model.SaveChangesAsync()); }