Files
Partsource/PartSource.Api/Controllers/WipersController.cs
2023-12-19 14:49:30 -05:00

64 lines
1.8 KiB
C#

using Microsoft.AspNetCore.Mvc;
using PartSource.Data.Dtos;
using PartSource.Data.Models;
using PartSource.Data.Nexpart;
using PartSource.Services;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace PartSource.Api.Controllers
{
[Route("[controller]")]
[ApiController]
[ApiExplorerSettings(GroupName = "v1")]
public class WipersController : BaseNexpartController
{
private readonly NexpartService _nexpartService;
public WipersController(NexpartService nexpartService)
{
_nexpartService = nexpartService;
}
[HttpGet]
[Route("{baseVehicleId}")]
public async Task<ActionResult> GetWipersForVehicle(int baseVehicleId)
{
ApplicationSearch applicationSearch = new ApplicationSearch
{
VehicleIdentifier = new VehicleIdentifier
{
BaseVehicleId = baseVehicleId
},
MfrCode = new[] { "BOS", "TRI" },
PartType = new[]
{
new PartType { Id = 8852 }
},
Criterion = new[]
{
new Criterion
{
Attribute = "REGION",
Id = 2
}
},
GroupBy = "PARTTYPE"
};
ApplicationSearchResponse response = await _nexpartService.SendRequest<ApplicationSearch, ApplicationSearchResponse>(applicationSearch);
if (response.ResponseBody != null)
{
return NexpartResponse<ApplicationSearchResponse, object>(response);
}
else
{
return NotFound();
}
}
}
}