예제 #1
0
        public async Task DeleteAsync(int id)
        {
            try
            {
                var order = await _orderDataProvider.GetByOfferIdAsync(id);

                var message = $"Offer {id} cannot be deleted because order {order.Id} is attached to it.";
                _logger.LogError(message);
                throw new InvalidOperationException(message);
            }
            catch (EntityNotFoundException)
            {
                await _offerDataProvider.DeleteByIdAsync(id);
            }
        }
예제 #2
0
 public async Task <Order> GetByOfferIdAsync(int offerId, QuerySet query = null)
 {
     return(await _orderDataProvider.GetByOfferIdAsync(offerId, query));
 }