Publish to Sound Press dev ops
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<UserSecretsId>f9e2fd37-0f2d-4e3a-955a-8e49a16fce1c</UserSecretsId>
|
<UserSecretsId>f9e2fd37-0f2d-4e3a-955a-8e49a16fce1c</UserSecretsId>
|
||||||
<Configurations>Debug;Release;Also Debug</Configurations>
|
<Configurations>Debug;Release;Also Debug</Configurations>
|
||||||
<SatelliteResourceLanguages>en-us;en</SatelliteResourceLanguages>
|
<SatelliteResourceLanguages>en-us;en</SatelliteResourceLanguages>
|
||||||
@@ -30,18 +30,16 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.24" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.5" />
|
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.3.0" PrivateAssets="All" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
|
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.23" />
|
||||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.5" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
|
||||||
<PackageReference Include="Ratermania.Shopify" Version="6.16.11" />
|
<PackageReference Include="Ratermania.Shopify" Version="6.16.11" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.1" />
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="10.1.3" />
|
||||||
<PackageReference Include="Swashbuckle.AspNetCore.ReDoc" Version="6.3.1" />
|
<PackageReference Include="Swashbuckle.AspNetCore.ReDoc" Version="8.1.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\ratermania\Packages\Shopify\Shopify.csproj" />
|
|
||||||
<ProjectReference Include="..\PartSource.Data\PartSource.Data.csproj" />
|
<ProjectReference Include="..\PartSource.Data\PartSource.Data.csproj" />
|
||||||
<ProjectReference Include="..\PartSource.Services\PartSource.Services.csproj" />
|
<ProjectReference Include="..\PartSource.Services\PartSource.Services.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Mvc.Formatters;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Serialization;
|
using Newtonsoft.Json.Serialization;
|
||||||
using PartSource.Data.Contexts;
|
using PartSource.Data.Contexts;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Configurations>Debug;Release;Also Debug</Configurations>
|
<Configurations>Debug;Release;Also Debug</Configurations>
|
||||||
<ServerGarbageCollection>true</ServerGarbageCollection>
|
<ServerGarbageCollection>true</ServerGarbageCollection>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@@ -12,19 +12,17 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
|
||||||
<PackageReference Include="Ratermania.Automation" Version="6.16.9" />
|
<PackageReference Include="Ratermania.Automation" Version="6.16.9" />
|
||||||
<PackageReference Include="Ratermania.Automation.Common" Version="6.16.9" />
|
<PackageReference Include="Ratermania.Automation.Common" Version="6.16.9" />
|
||||||
<PackageReference Include="Ratermania.JwtSpot" Version="6.16.9" />
|
<PackageReference Include="Ratermania.JwtSpot" Version="6.16.9" />
|
||||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\ratermania\Packages\Shopify\Shopify.csproj" />
|
|
||||||
<ProjectReference Include="..\PartSource.Data\PartSource.Data.csproj" />
|
<ProjectReference Include="..\PartSource.Data\PartSource.Data.csproj" />
|
||||||
<ProjectReference Include="..\PartSource.Services\PartSource.Services.csproj" />
|
<ProjectReference Include="..\PartSource.Services\PartSource.Services.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using PartSource.Data.Contexts;
|
using PartSource.Data.Contexts;
|
||||||
using PartSource.Data.Dtos;
|
|
||||||
using PartSource.Data.Models;
|
using PartSource.Data.Models;
|
||||||
|
|
||||||
namespace PartSource.Automation.Services
|
namespace PartSource.Automation.Services
|
||||||
|
|||||||
@@ -1,16 +1,13 @@
|
|||||||
#pragma warning disable CA2100 // Review SQL queries for security vulnerabilities
|
#pragma warning disable CA2100 // Review SQL queries for security vulnerabilities
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using Microsoft.Data.SqlClient;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using PartSource.Automation.Models.Configuration;
|
using PartSource.Automation.Models.Configuration;
|
||||||
using PartSource.Automation.Models.Enums;
|
using PartSource.Automation.Models.Enums;
|
||||||
using System;
|
|
||||||
using System.Collections.Concurrent;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data;
|
|
||||||
using System.Data.SqlClient;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace PartSource.Automation.Services
|
namespace PartSource.Automation.Services
|
||||||
{
|
{
|
||||||
@@ -36,7 +33,7 @@ namespace PartSource.Automation.Services
|
|||||||
|
|
||||||
// WHI changed the transfer protocol to SFTP and then messed with the directory structure.
|
// WHI changed the transfer protocol to SFTP and then messed with the directory structure.
|
||||||
// Since fitment isn't really all that automated anyway, just download the files manually with an SFTP client.
|
// Since fitment isn't really all that automated anyway, just download the files manually with an SFTP client.
|
||||||
Console.WriteLine($"Remember to manually download the {seoDataTypeString} files with an SFTP client. Press any key to continue.");
|
Console.WriteLine($"Remember to manually download the {seoDataTypeString} files with an SFTP client. Press enter to continue.");
|
||||||
Console.ReadLine();
|
Console.ReadLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Configurations>Debug;Release;Also Debug</Configurations>
|
<Configurations>Debug;Release;Also Debug</Configurations>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
@@ -17,12 +17,12 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.5">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.24">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.5" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.24" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Configurations>Debug;Release;Also Debug</Configurations>
|
<Configurations>Debug;Release;Also Debug</Configurations>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
@@ -12,12 +12,10 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AutoMapper" Version="11.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\ratermania\Packages\Shopify\Shopify.csproj" />
|
|
||||||
<ProjectReference Include="..\PartSource.Data\PartSource.Data.csproj" />
|
<ProjectReference Include="..\PartSource.Data\PartSource.Data.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1,237 +1,262 @@
|
|||||||
using AutoMapper;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using PartSource.Data;
|
|
||||||
using PartSource.Data.Contexts;
|
using PartSource.Data.Contexts;
|
||||||
using PartSource.Data.Dtos;
|
using PartSource.Data.Dtos;
|
||||||
using PartSource.Data.Models;
|
using PartSource.Data.Models;
|
||||||
using PartSource.Services.Extensions;
|
using PartSource.Services.Extensions;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
|
|
||||||
namespace PartSource.Services
|
namespace PartSource.Services
|
||||||
{
|
{
|
||||||
public class VehicleService
|
public class VehicleService
|
||||||
{
|
{
|
||||||
private readonly IMapper _mapper;
|
private readonly PartSourceContext _partSourceContext;
|
||||||
private readonly PartSourceContext _partSourceContext;
|
|
||||||
|
|
||||||
public VehicleService(IMapper mapper, PartSourceContext partSourceContext)
|
public VehicleService(PartSourceContext partSourceContext)
|
||||||
{
|
{
|
||||||
_mapper = mapper;
|
_partSourceContext = partSourceContext;
|
||||||
_partSourceContext = partSourceContext;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<IList<Vehicle>> GetVehicles(VehicleDto vehicleQuery)
|
public async Task<IList<Vehicle>> GetVehicles(VehicleDto vehicleQuery)
|
||||||
{
|
{
|
||||||
return await _partSourceContext.Vehicles
|
return await _partSourceContext.Vehicles
|
||||||
.ApplyQueryDto(vehicleQuery)
|
.ApplyQueryDto(vehicleQuery)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Vehicle> GetVehicleById(int vehicleToEngineConfigId)
|
public async Task<Vehicle> GetVehicleById(int vehicleToEngineConfigId)
|
||||||
{
|
{
|
||||||
return await _partSourceContext.Vehicles
|
return await _partSourceContext.Vehicles
|
||||||
.FirstOrDefaultAsync(v => v.VehicleToEngineConfigId == vehicleToEngineConfigId);
|
.FirstOrDefaultAsync(v => v.VehicleToEngineConfigId == vehicleToEngineConfigId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IList<MakeDto>> GetMakes(VehicleDto vehicleQuery)
|
public async Task<IList<MakeDto>> GetMakes(VehicleDto vehicleQuery)
|
||||||
{
|
{
|
||||||
return await _partSourceContext.Vehicles
|
return await _partSourceContext.Vehicles
|
||||||
.ApplyQueryDto(vehicleQuery)
|
.ApplyQueryDto(vehicleQuery)
|
||||||
.Select(v => new MakeDto
|
.Select(v => new MakeDto
|
||||||
{
|
{
|
||||||
MakeId = v.MakeId,
|
MakeId = v.MakeId,
|
||||||
MakeName = v.MakeName
|
MakeName = v.MakeName
|
||||||
|
|
||||||
})
|
})
|
||||||
.Distinct()
|
.Distinct()
|
||||||
.OrderBy(v => v.MakeName)
|
.OrderBy(v => v.MakeName)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<MakeDto> GetMakeById(int makeId)
|
public async Task<MakeDto> GetMakeById(int makeId)
|
||||||
{
|
{
|
||||||
Vehicle vehicle = await _partSourceContext.Vehicles
|
Vehicle vehicle = await _partSourceContext.Vehicles
|
||||||
.Where(v => v.MakeId == makeId)
|
.Where(v => v.MakeId == makeId)
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
return _mapper.Map<MakeDto>(vehicle);
|
return new MakeDto
|
||||||
}
|
{
|
||||||
|
MakeId = vehicle.MakeId,
|
||||||
|
MakeName = vehicle.MakeName
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<IList<ModelDto>> GetModels(VehicleDto vehicleQuery)
|
public async Task<IList<ModelDto>> GetModels(VehicleDto vehicleQuery)
|
||||||
{
|
{
|
||||||
return await _partSourceContext.Vehicles
|
return await _partSourceContext.Vehicles
|
||||||
.ApplyQueryDto(vehicleQuery)
|
.ApplyQueryDto(vehicleQuery)
|
||||||
.Select(v => new ModelDto
|
.Select(v => new ModelDto
|
||||||
{
|
{
|
||||||
ModelId = v.ModelId,
|
ModelId = v.ModelId,
|
||||||
ModelName = v.ModelName,
|
ModelName = v.ModelName,
|
||||||
MakeId = v.MakeId,
|
MakeId = v.MakeId,
|
||||||
MakeName = v.MakeName
|
MakeName = v.MakeName
|
||||||
})
|
})
|
||||||
.Distinct()
|
.Distinct()
|
||||||
.OrderBy(m => m.ModelName)
|
.OrderBy(m => m.ModelName)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<ModelDto> GetModelById(int modelId)
|
public async Task<ModelDto> GetModelById(int modelId)
|
||||||
{
|
{
|
||||||
Vehicle vehicle = await _partSourceContext.Vehicles
|
Vehicle vehicle = await _partSourceContext.Vehicles
|
||||||
.Where(m => m.ModelId == modelId)
|
.Where(m => m.ModelId == modelId)
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
return _mapper.Map<ModelDto>(vehicle);
|
return new ModelDto
|
||||||
}
|
{
|
||||||
|
MakeId = vehicle.MakeId,
|
||||||
|
MakeName = vehicle.MakeName,
|
||||||
|
ModelId = vehicle.ModelId,
|
||||||
|
ModelName = vehicle.ModelName
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task<IList<BaseVehicleDto>> GetBaseVehicles(VehicleDto vehicleQuery)
|
public async Task<IList<BaseVehicleDto>> GetBaseVehicles(VehicleDto vehicleQuery)
|
||||||
{
|
{
|
||||||
return await _partSourceContext.Vehicles
|
return await _partSourceContext.Vehicles
|
||||||
.ApplyQueryDto(vehicleQuery)
|
.ApplyQueryDto(vehicleQuery)
|
||||||
.Select(v => new BaseVehicleDto
|
.Select(v => new BaseVehicleDto
|
||||||
{
|
{
|
||||||
BaseVehicleId = v.BaseVehicleId,
|
BaseVehicleId = v.BaseVehicleId,
|
||||||
MakeName = v.MakeName,
|
MakeName = v.MakeName,
|
||||||
MakeId = v.MakeId,
|
MakeId = v.MakeId,
|
||||||
ModelName = v.ModelName,
|
ModelName = v.ModelName,
|
||||||
ModelId = v.ModelId,
|
ModelId = v.ModelId,
|
||||||
Year = v.Year
|
Year = v.Year
|
||||||
})
|
})
|
||||||
.Distinct()
|
.Distinct()
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<BaseVehicleDto> GetBaseVehicleById(int baseVehicleId)
|
public async Task<BaseVehicleDto> GetBaseVehicleById(int baseVehicleId)
|
||||||
{
|
{
|
||||||
Vehicle vehicle = await _partSourceContext.Vehicles
|
Vehicle vehicle = await _partSourceContext.Vehicles
|
||||||
.Where(b => b.BaseVehicleId == baseVehicleId)
|
.Where(b => b.BaseVehicleId == baseVehicleId)
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
return _mapper.Map<BaseVehicleDto>(vehicle);
|
return new BaseVehicleDto
|
||||||
}
|
{
|
||||||
|
MakeId = vehicle.MakeId,
|
||||||
|
MakeName = vehicle.MakeName,
|
||||||
|
ModelId = vehicle.ModelId,
|
||||||
|
ModelName = vehicle.ModelName,
|
||||||
|
Year = vehicle.Year,
|
||||||
|
BaseVehicleId = vehicle.BaseVehicleId
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<IList<EngineDto>> GetEngines(VehicleDto vehicleQuery)
|
public async Task<IList<EngineDto>> GetEngines(VehicleDto vehicleQuery)
|
||||||
{
|
{
|
||||||
return await _partSourceContext.Vehicles
|
return await _partSourceContext.Vehicles
|
||||||
.ApplyQueryDto(vehicleQuery)
|
.ApplyQueryDto(vehicleQuery)
|
||||||
.Select(v => new EngineDto
|
.Select(v => new EngineDto
|
||||||
{
|
{
|
||||||
EngineConfigId = v.EngineConfigId,
|
EngineConfigId = v.EngineConfigId,
|
||||||
EngineDescription = v.EngineDescription,
|
EngineDescription = v.EngineDescription,
|
||||||
MakeName = v.MakeName,
|
MakeName = v.MakeName,
|
||||||
MakeId = v.MakeId
|
MakeId = v.MakeId
|
||||||
})
|
})
|
||||||
.Distinct()
|
.Distinct()
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<EngineDto> GetEngineById(int engineConfigId)
|
public async Task<EngineDto> GetEngineById(int engineConfigId)
|
||||||
{
|
{
|
||||||
Vehicle vehicle = await _partSourceContext.Vehicles
|
Vehicle vehicle = await _partSourceContext.Vehicles
|
||||||
.Where(e => e.EngineConfigId == engineConfigId)
|
.Where(e => e.EngineConfigId == engineConfigId)
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
return _mapper.Map<EngineDto>(vehicle);
|
return new EngineDto
|
||||||
}
|
{
|
||||||
|
MakeId = vehicle.MakeId,
|
||||||
|
MakeName = vehicle.MakeName,
|
||||||
|
EngineConfigId = vehicle.EngineConfigId,
|
||||||
|
EngineDescription = vehicle.EngineDescription
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<IList<SubmodelDto>> GetSubmodels(VehicleDto vehicleQuery)
|
public async Task<IList<SubmodelDto>> GetSubmodels(VehicleDto vehicleQuery)
|
||||||
{
|
{
|
||||||
return await _partSourceContext.Vehicles
|
return await _partSourceContext.Vehicles
|
||||||
.ApplyQueryDto(vehicleQuery)
|
.ApplyQueryDto(vehicleQuery)
|
||||||
.GroupBy(v => new { v.SubmodelId, v.SubmodelName, v.MakeId, v.MakeName })
|
.GroupBy(v => new { v.SubmodelId, v.SubmodelName, v.MakeId, v.MakeName })
|
||||||
.Select(v => new SubmodelDto
|
.Select(v => new SubmodelDto
|
||||||
{
|
{
|
||||||
SubmodelId = v.Key.SubmodelId,
|
SubmodelId = v.Key.SubmodelId,
|
||||||
SubmodelName = v.Key.SubmodelName,
|
SubmodelName = v.Key.SubmodelName,
|
||||||
MakeId = v.Key.MakeId,
|
MakeId = v.Key.MakeId,
|
||||||
MakeName = v.Key.MakeName
|
MakeName = v.Key.MakeName
|
||||||
})
|
})
|
||||||
.Distinct()
|
.Distinct()
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<SubmodelDto> GetSubmodelById(int submodelId)
|
public async Task<SubmodelDto> GetSubmodelById(int submodelId)
|
||||||
{
|
{
|
||||||
Vehicle vehicle = await _partSourceContext.Vehicles
|
Vehicle vehicle = await _partSourceContext.Vehicles
|
||||||
.Where(s => s.SubmodelId == submodelId)
|
.Where(s => s.SubmodelId == submodelId)
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
return _mapper.Map<SubmodelDto>(vehicle);
|
return new SubmodelDto {
|
||||||
}
|
SubmodelName = vehicle.SubmodelName,
|
||||||
|
SubmodelId = vehicle.SubmodelId,
|
||||||
|
MakeId= vehicle.MakeId,
|
||||||
|
MakeName = vehicle.MakeName
|
||||||
|
};
|
||||||
|
|
||||||
#region Legacy API Support
|
}
|
||||||
|
|
||||||
[Obsolete]
|
#region Legacy API Support
|
||||||
public async Task<Vehicle> GetVehicle(int baseVehicleId, int engineConfigId, int submodelId)
|
|
||||||
{
|
|
||||||
return await _partSourceContext.Vehicles.FirstOrDefaultAsync(d =>
|
|
||||||
d.BaseVehicleId == baseVehicleId
|
|
||||||
&& d.EngineConfigId == engineConfigId
|
|
||||||
&& d.SubmodelId == submodelId
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Obsolete]
|
[Obsolete]
|
||||||
public async Task<IList<Submodel>> GetSubmodels(int makeId, int modelId, int year)
|
public async Task<Vehicle> GetVehicle(int baseVehicleId, int engineConfigId, int submodelId)
|
||||||
{
|
{
|
||||||
return await _partSourceContext.Submodels.Where(s =>
|
return await _partSourceContext.Vehicles.FirstOrDefaultAsync(d =>
|
||||||
s.MakeId == makeId
|
d.BaseVehicleId == baseVehicleId
|
||||||
&& s.ModelId == modelId
|
&& d.EngineConfigId == engineConfigId
|
||||||
&& s.Year == year
|
&& d.SubmodelId == submodelId
|
||||||
)
|
);
|
||||||
.ToListAsync();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
[Obsolete]
|
[Obsolete]
|
||||||
public async Task<IList<Engine>> GetEngines(int baseVehicleId)
|
public async Task<IList<Submodel>> GetSubmodels(int makeId, int modelId, int year)
|
||||||
{
|
{
|
||||||
return await _partSourceContext.Engines.Where(e => e.BaseVehicleId == baseVehicleId).ToListAsync();
|
return await _partSourceContext.Submodels.Where(s =>
|
||||||
}
|
s.MakeId == makeId
|
||||||
|
&& s.ModelId == modelId
|
||||||
|
&& s.Year == year
|
||||||
|
)
|
||||||
|
.ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
[Obsolete]
|
[Obsolete]
|
||||||
public async Task<IList<Engine>> GetEngines(int baseVehicleId, int submodelId)
|
public async Task<IList<Engine>> GetEngines(int baseVehicleId)
|
||||||
{
|
{
|
||||||
return await _partSourceContext.Engines.Where(e =>
|
return await _partSourceContext.Engines.Where(e => e.BaseVehicleId == baseVehicleId).ToListAsync();
|
||||||
e.BaseVehicleId == baseVehicleId
|
}
|
||||||
&& e.SubmodelId == submodelId
|
|
||||||
)
|
|
||||||
.ToListAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Obsolete]
|
[Obsolete]
|
||||||
public async Task<BaseVehicle> GetBaseVehicle(int makeId, int modelId, int year)
|
public async Task<IList<Engine>> GetEngines(int baseVehicleId, int submodelId)
|
||||||
{
|
{
|
||||||
return await _partSourceContext.BaseVehicles.FirstOrDefaultAsync(d =>
|
return await _partSourceContext.Engines.Where(e =>
|
||||||
d.MakeId == makeId
|
e.BaseVehicleId == baseVehicleId
|
||||||
&& d.ModelId == modelId
|
&& e.SubmodelId == submodelId
|
||||||
&& d.Year == year
|
)
|
||||||
);
|
.ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Obsolete]
|
[Obsolete]
|
||||||
public async Task<IList<VehicleModel>> GetModels(int makeId, int year)
|
public async Task<BaseVehicle> GetBaseVehicle(int makeId, int modelId, int year)
|
||||||
{
|
{
|
||||||
return await _partSourceContext.VehicleModels
|
return await _partSourceContext.BaseVehicles.FirstOrDefaultAsync(d =>
|
||||||
.Where(m =>
|
d.MakeId == makeId
|
||||||
m.MakeId == makeId
|
&& d.ModelId == modelId
|
||||||
&& m.Year == year
|
&& d.Year == year
|
||||||
)
|
);
|
||||||
.OrderBy(d => d.Name)
|
}
|
||||||
.ToListAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
[Obsolete]
|
[Obsolete]
|
||||||
public async Task<IList<VehicleMake>> GetMakes()
|
public async Task<IList<VehicleModel>> GetModels(int makeId, int year)
|
||||||
{
|
{
|
||||||
return await _partSourceContext.VehicleMakes
|
return await _partSourceContext.VehicleModels
|
||||||
.OrderBy(m => m.Name)
|
.Where(m =>
|
||||||
.ToListAsync();
|
m.MakeId == makeId
|
||||||
}
|
&& m.Year == year
|
||||||
#endregion
|
)
|
||||||
}
|
.OrderBy(d => d.Name)
|
||||||
|
.ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Obsolete]
|
||||||
|
public async Task<IList<VehicleMake>> GetMakes()
|
||||||
|
{
|
||||||
|
return await _partSourceContext.VehicleMakes
|
||||||
|
.OrderBy(m => m.Name)
|
||||||
|
.ToListAsync();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,10 +11,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PartSource.Services", "Part
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PartSource.Automation", "PartSource.Automation\PartSource.Automation.csproj", "{C85D675B-A76C-4F9C-9C57-1E063211C946}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PartSource.Automation", "PartSource.Automation\PartSource.Automation.csproj", "{C85D675B-A76C-4F9C-9C57-1E063211C946}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shopify", "..\ratermania\Packages\Shopify\Shopify.csproj", "{DBAE670D-D4DC-CF6C-0615-1026D17A92D0}"
|
|
||||||
EndProject
|
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shopify.BulkUpdate", "..\ratermania\Packages\Shopify.BulkUpdate\Shopify.BulkUpdate.csproj", "{E9F85D14-D6A6-1412-E0E6-69D47766694A}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -73,30 +69,6 @@ Global
|
|||||||
{C85D675B-A76C-4F9C-9C57-1E063211C946}.Release|x64.Build.0 = Release|Any CPU
|
{C85D675B-A76C-4F9C-9C57-1E063211C946}.Release|x64.Build.0 = Release|Any CPU
|
||||||
{C85D675B-A76C-4F9C-9C57-1E063211C946}.Release|x86.ActiveCfg = Release|Any CPU
|
{C85D675B-A76C-4F9C-9C57-1E063211C946}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{C85D675B-A76C-4F9C-9C57-1E063211C946}.Release|x86.Build.0 = Release|Any CPU
|
{C85D675B-A76C-4F9C-9C57-1E063211C946}.Release|x86.Build.0 = Release|Any CPU
|
||||||
{DBAE670D-D4DC-CF6C-0615-1026D17A92D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{DBAE670D-D4DC-CF6C-0615-1026D17A92D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{DBAE670D-D4DC-CF6C-0615-1026D17A92D0}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{DBAE670D-D4DC-CF6C-0615-1026D17A92D0}.Debug|x64.Build.0 = Debug|Any CPU
|
|
||||||
{DBAE670D-D4DC-CF6C-0615-1026D17A92D0}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{DBAE670D-D4DC-CF6C-0615-1026D17A92D0}.Debug|x86.Build.0 = Debug|Any CPU
|
|
||||||
{DBAE670D-D4DC-CF6C-0615-1026D17A92D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{DBAE670D-D4DC-CF6C-0615-1026D17A92D0}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{DBAE670D-D4DC-CF6C-0615-1026D17A92D0}.Release|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{DBAE670D-D4DC-CF6C-0615-1026D17A92D0}.Release|x64.Build.0 = Release|Any CPU
|
|
||||||
{DBAE670D-D4DC-CF6C-0615-1026D17A92D0}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{DBAE670D-D4DC-CF6C-0615-1026D17A92D0}.Release|x86.Build.0 = Release|Any CPU
|
|
||||||
{E9F85D14-D6A6-1412-E0E6-69D47766694A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{E9F85D14-D6A6-1412-E0E6-69D47766694A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{E9F85D14-D6A6-1412-E0E6-69D47766694A}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{E9F85D14-D6A6-1412-E0E6-69D47766694A}.Debug|x64.Build.0 = Debug|Any CPU
|
|
||||||
{E9F85D14-D6A6-1412-E0E6-69D47766694A}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{E9F85D14-D6A6-1412-E0E6-69D47766694A}.Debug|x86.Build.0 = Debug|Any CPU
|
|
||||||
{E9F85D14-D6A6-1412-E0E6-69D47766694A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{E9F85D14-D6A6-1412-E0E6-69D47766694A}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{E9F85D14-D6A6-1412-E0E6-69D47766694A}.Release|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{E9F85D14-D6A6-1412-E0E6-69D47766694A}.Release|x64.Build.0 = Release|Any CPU
|
|
||||||
{E9F85D14-D6A6-1412-E0E6-69D47766694A}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
{E9F85D14-D6A6-1412-E0E6-69D47766694A}.Release|x86.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
Reference in New Issue
Block a user