WIP
This commit is contained in:
@@ -41,6 +41,66 @@ namespace PartSource.Api.Controllers
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
Item[] items = new[]
|
||||
{
|
||||
new Item { PartNumber = vehicleFitment.PartNumber, MfrCode = vehicleFitment.LineCode }
|
||||
};
|
||||
|
||||
SmartPageDataSearch smartPageDataSearch = new SmartPageDataSearch
|
||||
{
|
||||
Items = items
|
||||
};
|
||||
|
||||
SmartPageDataSearchResponse smartPageResponse = await _nexpartService.SendRequest<SmartPageDataSearch, SmartPageDataSearchResponse>(smartPageDataSearch);
|
||||
if (smartPageResponse.ResponseBody?.Item != null)
|
||||
{
|
||||
PartType[] partTypes = smartPageResponse.ResponseBody.Item.Select(i => new PartType
|
||||
{
|
||||
Id = i.Part.PartType.Id
|
||||
})
|
||||
.ToArray();
|
||||
|
||||
ApplicationSearch applicationSearch = new ApplicationSearch
|
||||
{
|
||||
VehicleIdentifier = new VehicleIdentifier
|
||||
{
|
||||
BaseVehicleId = vehicleFitment.BaseVehicleId,
|
||||
EngineConfigId = vehicleFitment.EngineConfigId
|
||||
},
|
||||
MfrCode = new[] { vehicleFitment.LineCode },
|
||||
PartType = partTypes,
|
||||
GroupBy = "MFR",
|
||||
QuestionOption = "QUESTION_OTHERWISE_APP"
|
||||
};
|
||||
|
||||
ApplicationSearchResponse response = await _nexpartService.SendRequest<ApplicationSearch, ApplicationSearchResponse>(applicationSearch);
|
||||
if (response.ResponseBody != null)
|
||||
{
|
||||
vehicleFitment.DriveTypes = new List<string>();
|
||||
|
||||
Question driveTypeQuestion = ((Questions)response.ResponseBody).Question
|
||||
.Where(q => q.Attribute == "DRIVE_TYPE")
|
||||
.FirstOrDefault();
|
||||
|
||||
if (driveTypeQuestion != null)
|
||||
{
|
||||
foreach (Answer answer in driveTypeQuestion.Answer)
|
||||
{
|
||||
applicationSearch.Criterion = new[]
|
||||
{
|
||||
new Criterion { Attribute = "DRIVE_TYPE", Id = answer.Id}
|
||||
};
|
||||
|
||||
ApplicationSearchResponse driveTypeResponse = await _nexpartService.SendRequest<ApplicationSearch, ApplicationSearchResponse>(applicationSearch);
|
||||
if (driveTypeResponse.ResponseBody != null && ((Apps)driveTypeResponse.ResponseBody).App.Where(a => a.Part == vehicleFitment.PartNumber).Any())
|
||||
{
|
||||
vehicleFitment.DriveTypes.Add(answer.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Ok(vehicleFitment);
|
||||
}
|
||||
|
||||
@@ -75,7 +135,7 @@ namespace PartSource.Api.Controllers
|
||||
PartNumber = part.PartNumber,
|
||||
MfrCode = m.WhiCode
|
||||
})
|
||||
.ToArray();
|
||||
.ToArray();
|
||||
|
||||
SmartPageDataSearch smartPageDataSearch = new SmartPageDataSearch
|
||||
{
|
||||
@@ -96,7 +156,7 @@ namespace PartSource.Api.Controllers
|
||||
{
|
||||
Id = i.Part.PartType.Id
|
||||
})
|
||||
.ToArray();
|
||||
.ToArray();
|
||||
|
||||
ApplicationSearch applicationSearch = new ApplicationSearch
|
||||
{
|
||||
@@ -129,7 +189,7 @@ namespace PartSource.Api.Controllers
|
||||
}
|
||||
|
||||
IList<string> positions = new List<string>();
|
||||
foreach (App app in response.ResponseBody?.App)
|
||||
foreach (App app in ((Apps)response.ResponseBody)?.App)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(app.Position) && app.Part == part.PartNumber)
|
||||
{
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace PartSource.Api.Controllers
|
||||
|
||||
if (response.ResponseBody != null)
|
||||
{
|
||||
return NexpartResponse<ApplicationSearchResponse, Apps>(response);
|
||||
return NexpartResponse<ApplicationSearchResponse, object>(response);
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
@@ -1,13 +1,4 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:31337",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
@@ -18,12 +9,20 @@
|
||||
},
|
||||
"PartSource.Api": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "api/values",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:5001;http://localhost:5000"
|
||||
}
|
||||
},
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:31337",
|
||||
"sslPort": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user