Initial commit
This commit is contained in:
36
PartSource.Api/Controllers/BaseNexpartController.cs
Normal file
36
PartSource.Api/Controllers/BaseNexpartController.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
// Decompiled with JetBrains decompiler
|
||||
// Type: PartSource.Controllers.BaseNexpartController
|
||||
// Assembly: PartSource, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||
// MVID: 9C95A003-DAA7-4079-9F59-D1FC80E1666C
|
||||
// Assembly location: C:\Users\Tommy\Desktop\PS temp\PartSource.dll
|
||||
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using PartSource.Data.Nexpart;
|
||||
using PartSource.Data.Nexpart.Interfaces;
|
||||
|
||||
namespace PartSource.Api.Controllers
|
||||
{
|
||||
public class BaseNexpartController : ControllerBase
|
||||
{
|
||||
protected ActionResult NexpartResponse<T, U>(T response) where T : IResponseElement<U>
|
||||
{
|
||||
Exceptions[] exceptions = response.PSResponseHeader.Exceptions;
|
||||
if ((exceptions != null ? ((uint)exceptions.Length > 0U ? 1 : 0) : 0) == 0)
|
||||
{
|
||||
return Ok(new
|
||||
{
|
||||
Data = response.ResponseBody
|
||||
});
|
||||
}
|
||||
|
||||
string empty = string.Empty;
|
||||
foreach (Exceptions exception in response.PSResponseHeader.Exceptions)
|
||||
empty += string.Format("{0}\n", (object)exception.Value);
|
||||
|
||||
return BadRequest(new
|
||||
{
|
||||
Data = response.ResponseBody
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
33
PartSource.Api/Controllers/ErrorController.cs
Normal file
33
PartSource.Api/Controllers/ErrorController.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Diagnostics;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PartSource.Api.Controllers
|
||||
{
|
||||
[Route("[controller]")]
|
||||
public class ErrorController : ControllerBase
|
||||
{
|
||||
[Route("")]
|
||||
[AllowAnonymous]
|
||||
public ActionResult Get()
|
||||
{
|
||||
IExceptionHandlerPathFeature exceptionFeature = HttpContext.Features.Get<IExceptionHandlerPathFeature>();
|
||||
|
||||
if (exceptionFeature != null)
|
||||
{
|
||||
string route = exceptionFeature.Path;
|
||||
|
||||
Exception ex = exceptionFeature.Error;
|
||||
|
||||
//TODO: Logging
|
||||
}
|
||||
|
||||
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||
}
|
||||
}
|
||||
}
|
||||
43
PartSource.Api/Controllers/InventoryController.cs
Normal file
43
PartSource.Api/Controllers/InventoryController.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using PartSource.Data.Models;
|
||||
using PartSource.Services;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace PartSource.Api.Controllers
|
||||
{
|
||||
[Route("[controller]")]
|
||||
[ApiController]
|
||||
public class InventoryController : BaseNexpartController
|
||||
{
|
||||
private readonly PartService _inventoryService;
|
||||
|
||||
public InventoryController(PartService inventoryService)
|
||||
{
|
||||
_inventoryService = inventoryService;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("sku/{sku}/storeNumber/{storeNumber}")]
|
||||
public async Task<ActionResult> GetInventory(int sku, int storeNumber)
|
||||
{
|
||||
PartsAvailability inventory = _inventoryService.GetInventory(sku, storeNumber);
|
||||
|
||||
if (inventory == null)
|
||||
{
|
||||
return NotFound($"No part matching SKU {sku} was found.");
|
||||
}
|
||||
|
||||
return Ok(new
|
||||
{
|
||||
data = new
|
||||
{
|
||||
StoreNumber = inventory.Store,
|
||||
Sku = sku,
|
||||
Quantity = inventory.QTY
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
159
PartSource.Api/Controllers/NexpartVehiclesController.cs
Normal file
159
PartSource.Api/Controllers/NexpartVehiclesController.cs
Normal file
@@ -0,0 +1,159 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using PartSource.Data.Nexpart;
|
||||
using PartSource.Services;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace PartSource.Api.Controllers
|
||||
{
|
||||
[Route("[controller]")]
|
||||
[ApiController]
|
||||
public class NexpartVehiclesController : BaseNexpartController
|
||||
{
|
||||
private readonly NexpartService _nexpartService;
|
||||
|
||||
public NexpartVehiclesController(NexpartService nexpartService)
|
||||
{
|
||||
this._nexpartService = nexpartService;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("types")]
|
||||
public async Task<ActionResult> GetVehicleTypes()
|
||||
{
|
||||
NexpartVehiclesController vehiclesController = this;
|
||||
VehicleTypesGetResponse response = await vehiclesController._nexpartService.SendRequest<VehicleTypesGet, VehicleTypesGetResponse>(new VehicleTypesGet());
|
||||
return vehiclesController.NexpartResponse<VehicleTypesGetResponse, VehicleTypes>(response);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("makes")]
|
||||
public async Task<ActionResult> GetMakes()
|
||||
{
|
||||
NexpartVehiclesController vehiclesController = this;
|
||||
MakeSearch requestContent = new MakeSearch()
|
||||
{
|
||||
VehicleTypeId = new int[] { 5, 6, 7 }
|
||||
};
|
||||
MakeSearchResponse response = await vehiclesController._nexpartService.SendRequest<MakeSearch, MakeSearchResponse>(requestContent);
|
||||
return vehiclesController.NexpartResponse<MakeSearchResponse, Makes>(response);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("makes/vehicletypeid/{vehicleTypeId}")]
|
||||
public async Task<ActionResult> GetMakes(int vehicleTypeId)
|
||||
{
|
||||
NexpartVehiclesController vehiclesController = this;
|
||||
MakeSearch requestContent = new MakeSearch()
|
||||
{
|
||||
VehicleTypeId = new int[] { vehicleTypeId }
|
||||
};
|
||||
MakeSearchResponse response = await vehiclesController._nexpartService.SendRequest<MakeSearch, MakeSearchResponse>(requestContent);
|
||||
return vehiclesController.NexpartResponse<MakeSearchResponse, Makes>(response);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("models/makeid/{makeId}/modelyear/{year}")]
|
||||
public async Task<ActionResult> GetModels(int makeId, int year)
|
||||
{
|
||||
NexpartVehiclesController vehiclesController = this;
|
||||
ModelSearch requestContent = new ModelSearch()
|
||||
{
|
||||
MakeId = makeId,
|
||||
Year = year,
|
||||
VehicleTypeId = new int[] { 5, 6, 7 }
|
||||
};
|
||||
ModelSearchResponse response = await vehiclesController._nexpartService.SendRequest<ModelSearch, ModelSearchResponse>(requestContent);
|
||||
return vehiclesController.NexpartResponse<ModelSearchResponse, Models[]>(response);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("models/makeid/{makeId}/modelyear/{year}/vehicletypeid/{vehicleTypeId}")]
|
||||
public async Task<ActionResult> GetModels(int makeId, int year, int vehicleTypeId)
|
||||
{
|
||||
NexpartVehiclesController vehiclesController = this;
|
||||
ModelSearch requestContent = new ModelSearch()
|
||||
{
|
||||
MakeId = makeId,
|
||||
Year = year,
|
||||
VehicleTypeId = new int[] { vehicleTypeId }
|
||||
};
|
||||
ModelSearchResponse response = await vehiclesController._nexpartService.SendRequest<ModelSearch, ModelSearchResponse>(requestContent);
|
||||
return vehiclesController.NexpartResponse<ModelSearchResponse, Models[]>(response);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("basevehicle/makeid/{makeId}/modelid/{modelId}/modelyear/{year}")]
|
||||
public async Task<ActionResult> GetBaseVehicle(int makeId, int modelId, int year)
|
||||
{
|
||||
BaseVehicleDetailLookup requestContent = new BaseVehicleDetailLookup()
|
||||
{
|
||||
MakeId = makeId,
|
||||
ModelId = modelId,
|
||||
Year = year
|
||||
};
|
||||
BaseVehicleDetailLookupResponse response = await _nexpartService.SendRequest<BaseVehicleDetailLookup, BaseVehicleDetailLookupResponse>(requestContent);
|
||||
return NexpartResponse<BaseVehicleDetailLookupResponse, BaseVehicleDetail>(response);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("engines/basevehicleid/{baseVehicleId}")]
|
||||
[Route("engines/basevehicleid/{baseVehicleId}/submodelid/{subModelId}")]
|
||||
public async Task<ActionResult> GetEngines(int baseVehicleId, int? subModelId = null)
|
||||
{
|
||||
EngineSearch requestContent = new EngineSearch()
|
||||
{
|
||||
VehicleIdentifier = new VehicleIdentifier()
|
||||
{
|
||||
BaseVehicleId = baseVehicleId
|
||||
},
|
||||
SubModelId = subModelId
|
||||
};
|
||||
EngineSearchResponse response = await _nexpartService.SendRequest<EngineSearch, EngineSearchResponse>(requestContent);
|
||||
return NexpartResponse<EngineSearchResponse, Engines>(response);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("trim/makeid/{makeId}/modelid/{modelId}/modelyear/{year}")]
|
||||
public async Task<ActionResult> GetTrim(int makeId, int modelId, int year)
|
||||
{
|
||||
SubModelSearch requestContent = new SubModelSearch()
|
||||
{
|
||||
MakeId = makeId,
|
||||
ModelId = modelId,
|
||||
Year = year,
|
||||
RegionId = 2
|
||||
};
|
||||
SubModelSearchResponse response = await _nexpartService.SendRequest<SubModelSearch, SubModelSearchResponse>(requestContent);
|
||||
return NexpartResponse<SubModelSearchResponse, SubModels>(response);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("/detail/basevehicleid/{baseVehicleId}/submodelid/{subModelId}/engineconfigid/{engineConfigId}")]
|
||||
public async Task<ActionResult> GetVehicleId(int baseVehicleId, int subModelId, int engineConfigId)
|
||||
{
|
||||
VehicleIdSearch requestContent = new VehicleIdSearch
|
||||
{
|
||||
VehicleIdentifier = new VehicleIdentifier()
|
||||
{
|
||||
BaseVehicleId = baseVehicleId,
|
||||
EngineConfigId = engineConfigId
|
||||
},
|
||||
Criterion = new Criterion[1]{
|
||||
new Criterion
|
||||
{
|
||||
Attribute = "SUB_MODEL",
|
||||
Id = subModelId
|
||||
}
|
||||
},
|
||||
RegionId = new RegionId
|
||||
{
|
||||
Value = 2
|
||||
},
|
||||
};
|
||||
|
||||
VehicleIdSearchResponse response = await _nexpartService.SendRequest<VehicleIdSearch, VehicleIdSearchResponse>(requestContent);
|
||||
return NexpartResponse<VehicleIdSearchResponse, VehicleDetail>(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
92
PartSource.Api/Controllers/PartsController.cs
Normal file
92
PartSource.Api/Controllers/PartsController.cs
Normal file
@@ -0,0 +1,92 @@
|
||||
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;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace PartSource.Api.Controllers
|
||||
{
|
||||
[Route("[controller]")]
|
||||
[ApiController]
|
||||
public class PartsController : BaseNexpartController
|
||||
{
|
||||
private readonly NexpartService _nexpartService;
|
||||
private readonly PartService _partService;
|
||||
|
||||
public PartsController(NexpartService nexpartService, PartService partService)
|
||||
{
|
||||
this._nexpartService = nexpartService;
|
||||
_partService = partService;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("PartNumber/{partNumber}/LineCode/{lineCode}")]
|
||||
public ActionResult GetPart(string partNumber, string lineCode)
|
||||
{
|
||||
new SmartPageDataSearch().Items = new Item[1]
|
||||
{
|
||||
new Item()
|
||||
{
|
||||
PartNumber = partNumber.ToUpperInvariant(),
|
||||
MfrCode = lineCode.ToUpperInvariant()
|
||||
}
|
||||
};
|
||||
return (ActionResult)this.Ok();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("search/basevehicleid/{baseVehicleId}")]
|
||||
public async Task<ActionResult> Search(int baseVehicleId, [FromQuery] string query)
|
||||
{
|
||||
PartsController partsController = this;
|
||||
PartTypeSearch requestContent = new PartTypeSearch()
|
||||
{
|
||||
SearchString = query,
|
||||
SearchType = "ALL",
|
||||
SearchOptions = "PARTIAL_MATCH",
|
||||
VehicleIdentifier = new VehicleIdentifier()
|
||||
{
|
||||
BaseVehicleId = baseVehicleId
|
||||
}
|
||||
};
|
||||
PartTypeSearchResponse response = await partsController._nexpartService.SendRequest<PartTypeSearch, PartTypeSearchResponse>(requestContent);
|
||||
return partsController.NexpartResponse<PartTypeSearchResponse, PartTypes>(response);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("validate/partTypeId/{partTypeId}/baseVehicleId/{baseVehicleId}")]
|
||||
public async Task<ActionResult> ValidatePartFitment(int partTypeId, int baseVehicleId)
|
||||
{
|
||||
PartsController partsController = this;
|
||||
PartTypesValidateLookup typesValidateLookup = new PartTypesValidateLookup();
|
||||
typesValidateLookup.PartTypes = new PartType[1]
|
||||
{
|
||||
new PartType() { Id = partTypeId }
|
||||
};
|
||||
typesValidateLookup.VehicleIdentifier = new VehicleIdentifier()
|
||||
{
|
||||
BaseVehicleId = baseVehicleId
|
||||
};
|
||||
PartTypesValidateLookup requestContent = typesValidateLookup;
|
||||
PartTypesValidateLookupResponse response = await partsController._nexpartService.SendRequest<PartTypesValidateLookup, PartTypesValidateLookupResponse>(requestContent);
|
||||
return partsController.NexpartResponse<PartTypesValidateLookupResponse, PartTypes>(response);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("search/fitment")]
|
||||
public async Task<ActionResult> FitmentSearch([FromQuery] FitmentSearchDto fitmentSearchDto)
|
||||
{
|
||||
IList<Fitment> fitments = _partService.GetFitments(fitmentSearchDto);
|
||||
|
||||
if (fitments == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return Ok(new { Data = fitments });
|
||||
}
|
||||
}
|
||||
}
|
||||
32
PartSource.Api/Controllers/SearchController.cs
Normal file
32
PartSource.Api/Controllers/SearchController.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using PartSource.Data.Nexpart;
|
||||
using PartSource.Services;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PartSource.Api.Controllers
|
||||
{
|
||||
[Route("[controller]")]
|
||||
[ApiController]
|
||||
public class SearchController : BaseNexpartController
|
||||
{
|
||||
private readonly NexpartService _nexpartService;
|
||||
|
||||
public SearchController()
|
||||
{
|
||||
this._nexpartService = new NexpartService();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("makes/vehicletypeid/{vehicleTypeId}")]
|
||||
public async Task<ActionResult> GetMakes(int vehicleTypeId)
|
||||
{
|
||||
SearchController searchController = this;
|
||||
MakeSearch requestContent = new MakeSearch()
|
||||
{
|
||||
VehicleTypeId = new int[] { vehicleTypeId }
|
||||
};
|
||||
MakeSearchResponse response = await searchController._nexpartService.SendRequest<MakeSearch, MakeSearchResponse>(requestContent);
|
||||
return searchController.NexpartResponse<MakeSearchResponse, Makes>(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
47
PartSource.Api/Controllers/StoresController.cs
Normal file
47
PartSource.Api/Controllers/StoresController.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
//using Microsoft.AspNetCore.Mvc;
|
||||
//using PartSource.Data.Models;
|
||||
//using PartSource.Services;
|
||||
//using System.Web.Http;
|
||||
|
||||
//namespace PartSource.Api.Controllers
|
||||
//{
|
||||
// [Route("stores")]
|
||||
// public class StoresController : ControllerBase
|
||||
// {
|
||||
// private const int Count = 5;
|
||||
// private const int Page = 1;
|
||||
// private readonly LocationService _service;
|
||||
|
||||
// public StoresController(LocationService service)
|
||||
// {
|
||||
// this._service = service;
|
||||
// }
|
||||
|
||||
// [HttpGet]
|
||||
// [Route("nearest/{postal}")]
|
||||
// [Route("nearest/{postal}/count/{count}")]
|
||||
// [Route("nearest/{postal}/count/{count}/page/{page}")]
|
||||
// public ActionResult GetNearestStores(string postal, int count = 5, int page = 1)
|
||||
// {
|
||||
// PostalCode postalCodeData = this._service.GetPostalCodeData(postal);
|
||||
// if (postalCodeData == null)
|
||||
// return (ActionResult)this.BadRequest("Invalid postal code");
|
||||
// return (ActionResult)this.Ok(new
|
||||
// {
|
||||
// Data = this._service.GetClosestLocations(postalCodeData, count, page)
|
||||
// });
|
||||
// }
|
||||
|
||||
// [HttpGet]
|
||||
// [Route("nearest/{postal}/radius/{radius}")]
|
||||
// [Route("nearest/{postal}/radius/{radius}/count/{count}")]
|
||||
// [Route("nearest/{postal}/radius/{radius}/count/{count}/page/{page}")]
|
||||
// public ActionResult GetNearestStores(string postal, double radius, int count = 5, int page = 1)
|
||||
// {
|
||||
// return (ActionResult)this.Ok(new
|
||||
// {
|
||||
// Data = this._service.GetClosestLocations(this._service.GetPostalCodeData(postal), count, page, radius)
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
40
PartSource.Api/Controllers/TemplatesController.cs
Normal file
40
PartSource.Api/Controllers/TemplatesController.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PartSource.Api.Controllers
|
||||
{
|
||||
[Route("[controller]")]
|
||||
[ApiController]
|
||||
public class TemplatesController : ControllerBase
|
||||
{
|
||||
|
||||
[Route("{templateName}/{vehicleId}")]
|
||||
[HttpGet]
|
||||
public IActionResult GetTemplate(string templateName, int vehicleId)
|
||||
{
|
||||
StringValues contentType = new StringValues("application/liquid");
|
||||
Response.Headers.Add("Content-Type", contentType);
|
||||
|
||||
string content = $"{templateName},{vehicleId}";
|
||||
|
||||
return Ok(content);
|
||||
}
|
||||
|
||||
//Crappy oauth code to make the app installable on shopify
|
||||
|
||||
//HttpRequest request = HttpContext.Request;
|
||||
|
||||
//string location = "https://ratermaniac.myshopify.com/admin/oauth/authorize?client_id=097de154602f28499e058f66b8653033&scope=read_customers&redirect_uri=https://soundpress.com&state=0.4585849384";
|
||||
|
||||
//StringValues locationHeader = new StringValues(location);
|
||||
|
||||
// //Response.Headers.Add("Location", location);
|
||||
|
||||
// return Redirect(location);
|
||||
}
|
||||
}
|
||||
101
PartSource.Api/Controllers/VehiclesController.cs
Normal file
101
PartSource.Api/Controllers/VehiclesController.cs
Normal file
@@ -0,0 +1,101 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using PartSource.Data.Models;
|
||||
using PartSource.Services;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PartSource.Api.Controllers
|
||||
{
|
||||
[Route("[controller]")]
|
||||
[ApiController]
|
||||
public class VehiclesController : BaseNexpartController
|
||||
{
|
||||
private readonly VehicleService _vehicleService;
|
||||
|
||||
public VehiclesController(VehicleService vehicleService)
|
||||
{
|
||||
this._vehicleService = vehicleService;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("makes")]
|
||||
public async Task<ActionResult> GetMakes()
|
||||
{
|
||||
IList<VehicleMake> makes = await _vehicleService.GetAllMakes();
|
||||
|
||||
return Ok(makes);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("models/makeid/{makeId}/modelyear/{year}")]
|
||||
public async Task<ActionResult> GetModels(int makeId, int year)
|
||||
{
|
||||
IList<VehicleData> models = await _vehicleService.GetModels(makeId, year);
|
||||
|
||||
return Ok(models);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("basevehicle/makeid/{makeId}/modelid/{modelId}/modelyear/{year}")]
|
||||
[Route("basevehicles/makeid/{makeId}/modelid/{modelId}/modelyear/{year}")]
|
||||
public async Task<ActionResult> GetBaseVehicle(int makeId, int modelId, int year)
|
||||
{
|
||||
IList<BaseVehicle> baseVehicles = await _vehicleService.GetBaseVehicles(makeId, modelId, year);
|
||||
|
||||
return Ok(baseVehicles);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("engines/basevehicleid/{baseVehicleId}")]
|
||||
[Route("engines/basevehicleid/{baseVehicleId}/submodelid/{subModelId}")]
|
||||
public async Task<ActionResult> GetEngines(int baseVehicleId, int? submodelId = null)
|
||||
{
|
||||
IList<Engine> engines = submodelId == null
|
||||
? await _vehicleService.GetEngines(baseVehicleId)
|
||||
: await _vehicleService.GetEngines(baseVehicleId, (int)submodelId);
|
||||
|
||||
return Ok(engines);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("trim/makeid/{makeId}/modelid/{modelId}/modelyear/{year}")]
|
||||
[Route("submodels/makeid/{makeId}/modelid/{modelId}/modelyear/{year}")]
|
||||
public async Task<ActionResult> GetSubmodels(int makeId, int modelId, int year)
|
||||
{
|
||||
IList<Submodel> submodels = await _vehicleService.GetSubmodels(makeId, modelId, year);
|
||||
|
||||
return Ok(submodels);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("/detail/basevehicleid/{baseVehicleId}/submodelid/{submodelId}/engineconfigid/{engineConfigId}")]
|
||||
public async Task<ActionResult> GetVehicleDetail(int baseVehicleId, int submodelId, int engineConfigId)
|
||||
{
|
||||
VehicleData vehicle = await _vehicleService.GetVehicle(baseVehicleId, engineConfigId, submodelId);
|
||||
|
||||
return Ok(vehicle);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("types")]
|
||||
public ActionResult GetVehicleTypes()
|
||||
{
|
||||
return new StatusCodeResult((int)HttpStatusCode.Gone);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("makes/vehicletypeid/{vehicleTypeId}")]
|
||||
public ActionResult GetMakes(int vehicleTypeId)
|
||||
{
|
||||
return new StatusCodeResult((int)HttpStatusCode.Gone);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("models/makeid/{makeId}/modelyear/{year}/vehicletypeid/{vehicleTypeId}")]
|
||||
public ActionResult GetModels(int makeId, int year, int vehicleTypeId)
|
||||
{
|
||||
return new StatusCodeResult((int)HttpStatusCode.Gone);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user