* Added new Entities and Dtos

* Mapping new classes
* Added new services and Controllers in API
This commit is contained in:
2025-08-07 06:46:43 +02:00
parent 1842fd6146
commit 6139ce97d7
18 changed files with 855 additions and 6 deletions

View File

@@ -0,0 +1,13 @@
using AutoMapper;
using Microsoft.EntityFrameworkCore;
using SytelineSaAppEfDataModel.Dtos;
namespace SytelineSaAppEfDataModel.Services;
public class CustomerService(SytelineSaAppDbContext context, IMapper mapper) : ICustomerService
{
public async Task<IList<CustomerDto>> GetAllCustomers()
{
return await context.Customers.Select(x => mapper.Map<CustomerDto>(x)).ToListAsync();
}
}

View File

@@ -0,0 +1,13 @@
using AutoMapper;
using Microsoft.EntityFrameworkCore;
using SytelineSaAppEfDataModel.Dtos;
namespace SytelineSaAppEfDataModel.Services;
public class CustomerTpService(SytelineSaAppDbContext context, IMapper mapper) : ICustomerTpService
{
public async Task<IList<CustomerTpDto>> GetAllCustomersTp()
{
return await context.CustomerTps.Select(x => mapper.Map<CustomerTpDto>(x)).ToListAsync();
}
}

View File

@@ -0,0 +1,13 @@
using AutoMapper;
using Microsoft.EntityFrameworkCore;
namespace SytelineSaAppEfDataModel.Services;
public class EdiCustomerOrderImportService(SytelineSaAppDbContext context, IMapper mapper) : IEdiCustomerOrderImportService
{
public async Task<DateTime> GetLastUpdateDate()
{
return (await context.EdiCustomerOrderImports.OrderByDescending(x => x.LastUpdateDate)
.FirstOrDefaultAsync())?.LastUpdateDate ?? DateTime.Now.Date;
}
}

View File

@@ -0,0 +1,8 @@
using SytelineSaAppEfDataModel.Dtos;
namespace SytelineSaAppEfDataModel.Services;
public interface ICustomerService
{
Task<IList<CustomerDto>> GetAllCustomers();
}

View File

@@ -0,0 +1,8 @@
using SytelineSaAppEfDataModel.Dtos;
namespace SytelineSaAppEfDataModel.Services;
public interface ICustomerTpService
{
Task<IList<CustomerTpDto>> GetAllCustomersTp();
}

View File

@@ -0,0 +1,6 @@
namespace SytelineSaAppEfDataModel.Services;
public interface IEdiCustomerOrderImportService
{
Task<DateTime> GetLastUpdateDate();
}