parent
6d72c7dda0
commit
e66b6a2402
@ -22,8 +22,7 @@ namespace Identity.API.Services
|
||||
|
||||
async public Task GetProfileDataAsync(ProfileDataRequestContext context)
|
||||
{
|
||||
var subject = context.Subject;
|
||||
if (subject == null) throw new ArgumentNullException(nameof(context.Subject));
|
||||
var subject = context.Subject ?? throw new ArgumentNullException(nameof(context.Subject));
|
||||
|
||||
var subjectId = subject.Claims.Where(x => x.Type == "sub").FirstOrDefault().Value;
|
||||
|
||||
@ -37,8 +36,7 @@ namespace Identity.API.Services
|
||||
|
||||
async public Task IsActiveAsync(IsActiveContext context)
|
||||
{
|
||||
var subject = context.Subject;
|
||||
if (subject == null) throw new ArgumentNullException(nameof(context.Subject));
|
||||
var subject = context.Subject ?? throw new ArgumentNullException(nameof(context.Subject));
|
||||
|
||||
var subjectId = subject.Claims.Where(x => x.Type == "sub").FirstOrDefault().Value;
|
||||
var user = await _userManager.FindByIdAsync(subjectId);
|
||||
|
@ -15,18 +15,8 @@
|
||||
// Using DI to inject infrastructure persistence Repositories
|
||||
public CreateOrderCommandHandler(IBuyerRepository buyerRepository, IOrderRepository orderRepository)
|
||||
{
|
||||
if (buyerRepository == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(buyerRepository));
|
||||
}
|
||||
|
||||
if (orderRepository == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(orderRepository));
|
||||
}
|
||||
|
||||
_buyerRepository = buyerRepository;
|
||||
_orderRepository = orderRepository;
|
||||
_buyerRepository = buyerRepository ?? throw new ArgumentNullException(nameof(buyerRepository));
|
||||
_orderRepository = orderRepository ?? throw new ArgumentNullException(nameof(orderRepository));
|
||||
}
|
||||
|
||||
public async Task<bool> Handle(CreateOrderCommand message)
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
public OrderQueries(string constr)
|
||||
{
|
||||
_connectionString = constr;
|
||||
_connectionString = !string.IsNullOrWhiteSpace(constr) ? constr : throw new ArgumentNullException(nameof(constr));
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,24 +20,10 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers
|
||||
|
||||
public OrdersController(IMediator mediator, IOrderQueries orderQueries, IIdentityService identityService)
|
||||
{
|
||||
if (mediator == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(mediator));
|
||||
}
|
||||
|
||||
if (orderQueries == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(orderQueries));
|
||||
}
|
||||
|
||||
if (identityService == null)
|
||||
{
|
||||
throw new ArgumentException(nameof(identityService));
|
||||
}
|
||||
|
||||
_mediator = mediator;
|
||||
_orderQueries = orderQueries;
|
||||
_identityService = identityService;
|
||||
_mediator = mediator ?? throw new ArgumentNullException(nameof(mediator));
|
||||
_orderQueries = orderQueries ?? throw new ArgumentNullException(nameof(orderQueries));
|
||||
_identityService = identityService ?? throw new ArgumentNullException(nameof(identityService));
|
||||
}
|
||||
|
||||
[Route("new")]
|
||||
|
@ -13,12 +13,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Infrastructure.Servi
|
||||
|
||||
public IdentityService(IHttpContextAccessor context)
|
||||
{
|
||||
if (context == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(context));
|
||||
}
|
||||
|
||||
_context = context;
|
||||
_context = context ?? throw new ArgumentNullException(nameof(context));
|
||||
}
|
||||
|
||||
public string GetUserIdentity()
|
||||
|
@ -21,12 +21,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.B
|
||||
|
||||
public Buyer(string identity) : this()
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(identity))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(identity));
|
||||
}
|
||||
|
||||
IdentityGuid = identity;
|
||||
IdentityGuid = !string.IsNullOrWhiteSpace(identity) ? identity : throw new ArgumentNullException(nameof(identity));
|
||||
|
||||
}
|
||||
|
||||
|
@ -21,20 +21,10 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.B
|
||||
|
||||
public PaymentMethod(int cardTypeId, string alias, string cardNumber, string securityNumber, string cardHolderName, DateTime expiration)
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(cardNumber))
|
||||
{
|
||||
throw new ArgumentException(nameof(cardNumber));
|
||||
}
|
||||
|
||||
if (String.IsNullOrWhiteSpace(securityNumber))
|
||||
{
|
||||
throw new ArgumentException(nameof(securityNumber));
|
||||
}
|
||||
|
||||
if (String.IsNullOrWhiteSpace(cardHolderName))
|
||||
{
|
||||
throw new ArgumentException(nameof(cardHolderName));
|
||||
}
|
||||
_cardNumber = !string.IsNullOrWhiteSpace(cardNumber) ? cardNumber : throw new ArgumentException(nameof(cardNumber));
|
||||
_securityNumber = !string.IsNullOrWhiteSpace(securityNumber) ? securityNumber : throw new ArgumentException(nameof(securityNumber));
|
||||
_cardHolderName = !string.IsNullOrWhiteSpace(cardHolderName) ? cardHolderName : throw new ArgumentException(nameof(cardHolderName));
|
||||
|
||||
if (expiration < DateTime.UtcNow)
|
||||
{
|
||||
@ -42,9 +32,6 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.B
|
||||
}
|
||||
|
||||
_alias = alias;
|
||||
_cardNumber = cardNumber;
|
||||
_securityNumber = securityNumber;
|
||||
_cardHolderName = cardHolderName;
|
||||
_expiration = expiration;
|
||||
_cardTypeId = cardTypeId;
|
||||
}
|
||||
|
@ -22,12 +22,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositor
|
||||
|
||||
public BuyerRepository(OrderingContext context)
|
||||
{
|
||||
if (context == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(context));
|
||||
}
|
||||
|
||||
_context = context;
|
||||
_context = context ?? throw new ArgumentNullException(nameof(context));
|
||||
}
|
||||
|
||||
public Buyer Add(Buyer buyer)
|
||||
|
@ -19,12 +19,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.Infrastructure.Repositor
|
||||
|
||||
public OrderRepository(OrderingContext context)
|
||||
{
|
||||
if (context == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(context));
|
||||
}
|
||||
|
||||
_context = context;
|
||||
_context = context ?? throw new ArgumentNullException(nameof(context));
|
||||
}
|
||||
|
||||
public Order Add(Order order)
|
||||
|
Loading…
x
Reference in New Issue
Block a user