* Added new Entity

* Added new Controller
This commit is contained in:
2025-08-22 06:47:09 +02:00
parent a0c7c2f6aa
commit eb40cc35fe
8 changed files with 769 additions and 17 deletions

View File

@@ -0,0 +1,8 @@
using SytelineSaAppEfDataModel.Dtos;
namespace SytelineSaAppEfDataModel.Services;
public interface IItemService
{
Task<ItemDto> GetItem(string itemNumber);
}

View File

@@ -0,0 +1,14 @@
using AutoMapper;
using Microsoft.EntityFrameworkCore;
using SytelineSaAppEfDataModel.Dtos;
namespace SytelineSaAppEfDataModel.Services;
public class ItemService(SytelineSaAppDbContext context, IMapper mapper) : IItemService
{
public async Task<ItemDto> GetItem(string itemNumber)
{
var item = await context.Items.FirstOrDefaultAsync(x => x.ItemCode == itemNumber);
return mapper.Map<ItemDto>(item);
}
}