* Further improvements to generate Packing List

This commit is contained in:
2025-05-16 21:48:43 +02:00
parent da1eae8ca9
commit 55f7ed76fd
25 changed files with 474 additions and 198 deletions

View File

@@ -5,4 +5,5 @@ namespace SytelineSaAppEfDataModel.Services;
public interface IWzHeaderService
{
Task<IEnumerable<WzHeaderDto>> GetAll();
Task CreateHeader(WzHeaderDto wzHeader);
}

View File

@@ -0,0 +1,9 @@
using SytelineSaAppEfDataModel.Dtos;
namespace SytelineSaAppEfDataModel.Services;
public interface IWzRowMeyleService
{
Task<IEnumerable<WzRowMeyleDto>> GetAll();
Task CreateRows(IEnumerable<WzRowMeyleDto> rows);
}

View File

@@ -1,6 +1,7 @@
using AutoMapper;
using Microsoft.EntityFrameworkCore;
using SytelineSaAppEfDataModel.Dtos;
using SytelineSaAppEfDataModel.Entities;
namespace SytelineSaAppEfDataModel.Services;
@@ -10,4 +11,11 @@ public class WzHeaderService(SytelineSaAppDbContext context, IMapper mapper) : I
{
return await context.WzHeaders.Select(x => mapper.Map<WzHeaderDto>(x)).ToListAsync();
}
public async Task CreateHeader(WzHeaderDto wzHeader)
{
var entity = mapper.Map<WzHeader>(wzHeader);
await context.WzHeaders.AddAsync(entity);
await context.SaveChangesAsync();
}
}

View File

@@ -0,0 +1,21 @@
using AutoMapper;
using Microsoft.EntityFrameworkCore;
using SytelineSaAppEfDataModel.Dtos;
using SytelineSaAppEfDataModel.Entities;
namespace SytelineSaAppEfDataModel.Services;
public class WzRowMeyleService(SytelineSaAppDbContext context, IMapper mapper) : IWzRowMeyleService
{
public async Task<IEnumerable<WzRowMeyleDto>> GetAll()
{
return await context.WzRowsMeyle.Select(x => mapper.Map<WzRowMeyleDto>(x)).ToListAsync();
}
public async Task CreateRows(IEnumerable<WzRowMeyleDto> rows)
{
var entities = mapper.Map<IEnumerable<WzRowMeyle>>(rows);
await context.WzRowsMeyle.AddRangeAsync(entities);
await context.SaveChangesAsync();
}
}