Files
FA_WEB/SytelineSaAppEfDataModel/Services/EdiCustomerOrderTranslateService.cs

24 lines
783 B
C#

using AutoMapper;
using Microsoft.EntityFrameworkCore;
using SytelineSaAppEfDataModel.Dtos;
namespace SytelineSaAppEfDataModel.Services;
public class EdiCustomerOrderTranslateService(SytelineSaAppDbContext context, IMapper mapper) : IEdiCustomerOrderTranslateService
{
public async Task<IEnumerable<EdiCustomerOrderTranslateDto>> GetAll()
{
return await context.EdiCustomerOrderTranslates.Select(x => mapper.Map<EdiCustomerOrderTranslateDto>(x))
.ToListAsync();
}
public async Task Delete(int id)
{
var entity = await context.EdiCustomerOrderTranslates.FindAsync(id);
if (entity != null)
{
context.EdiCustomerOrderTranslates.Remove(entity);
await context.SaveChangesAsync();
}
}
}