* Further improvements to generate Packing List
This commit is contained in:
21
SytelineSaAppEfDataModel/Services/WzRowMeyleService.cs
Normal file
21
SytelineSaAppEfDataModel/Services/WzRowMeyleService.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user