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); } }
public async Task <Order> GetByOfferIdAsync(int offerId, QuerySet query = null) { return(await _orderDataProvider.GetByOfferIdAsync(offerId, query)); }