Browse Source

Add OrderingDomainException when the order doesn't exist with id orderId

pull/809/head
Christian Arenas 7 years ago
parent
commit
ea1c50db7b
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      src/Services/Ordering/Ordering.Infrastructure/Repositories/OrderRepository.cs

+ 3
- 1
src/Services/Ordering/Ordering.Infrastructure/Repositories/OrderRepository.cs View File

@ -1,6 +1,7 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
using Microsoft.eShopOnContainers.Services.Ordering.Domain.Seedwork;
using Ordering.Domain.Exceptions;
using System;
using System.Threading.Tasks;
@ -32,7 +33,8 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositor
public async Task<Order> GetAsync(int orderId)
{
return await _context.Orders.FindAsync(orderId);
return await _context.Orders.FindAsync(orderId)
?? throw new OrderingDomainException($"Not able to get the order. Reason: no valid orderId: {orderId}");
}
public void Update(Order order)


Loading…
Cancel
Save