using DrinkRateAPI.ApiModels.ProductTable; using DrinkRateAPI.Contexts; using DrinkRateAPI.DbEntities; using DrinkRateAPI.Exceptions; using Microsoft.EntityFrameworkCore; namespace DrinkRateAPI.Services; public class ProductTableService(ApplicationDbContext context) { private ApplicationDbContext _context = context; public async Task GetProductTable(string productTableName) { var productTable = await _context.ProductTable.FirstOrDefaultAsync(x => x.ProductTableName == productTableName) ?? throw new NotFoundException($"Product table with the name {productTableName} not found."); return new ProductTableGet { ProductTableName = productTable.ProductTableName, ProductTableId = productTable.Id.ToString(), CompanyTableId = productTable.CompanyTableId.ToString(), }; } }