Files
FA_WEB/SytelineSaAppEfDataModel/Services/ErrorLogService.cs

26 lines
826 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(Guid customerOrderNumber)
{
return await context.ErrorLogs.Where(x => x.TrxNum == customerOrderNumber)
.Select(x => mapper.Map<ErrorLogDto>(x)).ToListAsync();
}
}
}