Initial commit
This commit is contained in:
45
PartSource.Services/PartService.cs
Normal file
45
PartSource.Services/PartService.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using PartSource.Data;
|
||||
using PartSource.Data.Dtos;
|
||||
using PartSource.Data.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace PartSource.Services
|
||||
{
|
||||
public class PartService
|
||||
{
|
||||
private readonly PartSourceContext _context;
|
||||
|
||||
public PartService(PartSourceContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public Part GetPart(string partNumber, string lineCode)
|
||||
{
|
||||
return _context.Parts.FirstOrDefault(p => p.PartNumber == partNumber && p.Manufacturer.LineCode == lineCode);
|
||||
}
|
||||
|
||||
public Part GetPart(int sku)
|
||||
{
|
||||
return _context.Parts.FirstOrDefault(p => p.Sku == sku);
|
||||
}
|
||||
|
||||
public PartsAvailability GetInventory(int sku, int storeNumber)
|
||||
{
|
||||
return _context.PartAvailabilities.FirstOrDefault(s => s.Store == storeNumber && s.SKU == sku);
|
||||
}
|
||||
|
||||
public IList<Fitment> GetFitments(FitmentSearchDto fitmentSearchDto)
|
||||
{
|
||||
return null;
|
||||
|
||||
//return _context.Fitments.Where(f =>
|
||||
// f.ManufacturerCode == fitmentSearchDto.ManufacturerCode &&
|
||||
// f.PartNumber == fitmentSearchDto.PartNumber &&
|
||||
// f.BaseVehicleId == fitmentSearchDto.BaseVehicleId &&
|
||||
// f.EngineConfigId == fitmentSearchDto.EngineConfigId
|
||||
//).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user