Add project files.
This commit is contained in:
25
SytelineSaAppEfDataModel/Services/ErrorLogService.cs
Normal file
25
SytelineSaAppEfDataModel/Services/ErrorLogService.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user