26 lines
828 B
C#
26 lines
828 B
C#
using AutoMapper;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using SytelineSaAppEfDataModel.Dtos;
|
|
|
|
namespace SytelineSaAppEfDataModel.Services
|
|
{
|
|
public class ErrorLogService(SytelineSaAppDbContext context, IMapper mapper) : IErrorLogService
|
|
{
|
|
public async Task<IEnumerable<ErrorLogDto>> GetAll()
|
|
{
|
|
return await context.ErrorLogs.Select(x => mapper.Map<ErrorLogDto>(x)).ToListAsync();
|
|
}
|
|
|
|
public async Task<IEnumerable<ErrorLogDto>> GetByOrderNumber(string customerOrderNumber)
|
|
{
|
|
return await context.ErrorLogs.Where(x => x.TrxNum == customerOrderNumber)
|
|
.Select(x => mapper.Map<ErrorLogDto>(x)).ToListAsync();
|
|
}
|
|
}
|
|
}
|