* Added Lot table and service
* Changed behaviour of scanning to scan first PartNumber, select specific record and then scan MeylePartNumber
This commit is contained in:
25
SytelineSaAppEfDataModel/Services/LotService.cs
Normal file
25
SytelineSaAppEfDataModel/Services/LotService.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using AutoMapper;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SytelineSaAppEfDataModel.Dtos;
|
||||
|
||||
namespace SytelineSaAppEfDataModel.Services;
|
||||
|
||||
public class LotService(SytelineSaAppDbContext context, IMapper mapper) : ILotService
|
||||
{
|
||||
public async Task<IEnumerable<LotDto>> GetAll()
|
||||
{
|
||||
return await context.Lots.Select(x => mapper.Map<LotDto>(x)).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<LotDto?> GetByItemNumber(string itemNumber)
|
||||
{
|
||||
return await context.Lots.Where(x => x.Item == itemNumber).Select(x => mapper.Map<LotDto>(x))
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<LotDto?> GetByLotNumber(string lotNumber)
|
||||
{
|
||||
return await context.Lots.Where(x => x.LotNumber == lotNumber).Select(x => mapper.Map<LotDto>(x))
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user