Little fix and refactoring (#1860)
* Delete repeat setting a property in CreateOrderCommand ctor * Fix catalogTypeName -> catalogBrandName in exception message * Delete useless null check from ConsentController * Add null check for subjectId
This commit is contained in:
parent
548a0ecaf2
commit
4ac25bf58d
@ -203,7 +203,7 @@ public class CatalogContextSeed
|
|||||||
string catalogBrandName = column[Array.IndexOf(headers, "catalogbrandname")].Trim('"').Trim();
|
string catalogBrandName = column[Array.IndexOf(headers, "catalogbrandname")].Trim('"').Trim();
|
||||||
if (!catalogBrandIdLookup.ContainsKey(catalogBrandName))
|
if (!catalogBrandIdLookup.ContainsKey(catalogBrandName))
|
||||||
{
|
{
|
||||||
throw new Exception($"type={catalogTypeName} does not exist in catalogTypes");
|
throw new Exception($"type={catalogBrandName} does not exist in catalogTypes");
|
||||||
}
|
}
|
||||||
|
|
||||||
string priceString = column[Array.IndexOf(headers, "price")].Trim('"').Trim();
|
string priceString = column[Array.IndexOf(headers, "price")].Trim('"').Trim();
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
response = ConsentResponse.Denied;
|
response = ConsentResponse.Denied;
|
||||||
}
|
}
|
||||||
// user clicked 'yes' - validate the data
|
// user clicked 'yes' - validate the data
|
||||||
else if (model.Button == "yes" && model != null)
|
else if (model.Button == "yes")
|
||||||
{
|
{
|
||||||
// if the user consented to some scope, build the response model
|
// if the user consented to some scope, build the response model
|
||||||
if (model.ScopesConsented != null && model.ScopesConsented.Any())
|
if (model.ScopesConsented != null && model.ScopesConsented.Any())
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
{
|
{
|
||||||
var subject = context.Subject ?? 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 subjectId = subject.Claims.Where(x => x.Type == "sub").FirstOrDefault()?.Value;
|
||||||
|
|
||||||
var user = await _userManager.FindByIdAsync(subjectId);
|
var user = await _userManager.FindByIdAsync(subjectId);
|
||||||
if (user == null)
|
if (user == null)
|
||||||
@ -27,7 +27,7 @@
|
|||||||
{
|
{
|
||||||
var subject = context.Subject ?? 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 subjectId = subject.Claims.Where(x => x.Type == "sub").FirstOrDefault()?.Value;
|
||||||
var user = await _userManager.FindByIdAsync(subjectId);
|
var user = await _userManager.FindByIdAsync(subjectId);
|
||||||
|
|
||||||
context.IsActive = false;
|
context.IsActive = false;
|
||||||
|
@ -79,7 +79,6 @@ public class CreateOrderCommand
|
|||||||
CardExpiration = cardExpiration;
|
CardExpiration = cardExpiration;
|
||||||
CardSecurityNumber = cardSecurityNumber;
|
CardSecurityNumber = cardSecurityNumber;
|
||||||
CardTypeId = cardTypeId;
|
CardTypeId = cardTypeId;
|
||||||
CardExpiration = cardExpiration;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user