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:
KurnakovMaksim 2022-03-09 17:51:19 +03:00 committed by GitHub
parent 548a0ecaf2
commit 4ac25bf58d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 5 deletions

View File

@ -203,7 +203,7 @@ public class CatalogContextSeed
string catalogBrandName = column[Array.IndexOf(headers, "catalogbrandname")].Trim('"').Trim();
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();

View File

@ -58,7 +58,7 @@
response = ConsentResponse.Denied;
}
// 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 (model.ScopesConsented != null && model.ScopesConsented.Any())

View File

@ -13,7 +13,7 @@
{
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);
if (user == null)
@ -27,7 +27,7 @@
{
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);
context.IsActive = false;

View File

@ -79,7 +79,6 @@ public class CreateOrderCommand
CardExpiration = cardExpiration;
CardSecurityNumber = cardSecurityNumber;
CardTypeId = cardTypeId;
CardExpiration = cardExpiration;
}