Files
ShopSolution-backend/Webshop.Application/Services/Public/ShopInfoService.cs
Tizian.Breuch 1692fe198e shop info
2025-08-12 11:07:15 +02:00

43 lines
1.4 KiB
C#

// src/Webshop.Application/Services/Public/ShopInfoService.cs
using System.Threading.Tasks;
using Webshop.Application.DTOs.Shop;
using Webshop.Domain.Interfaces;
namespace Webshop.Application.Services.Public
{
public class ShopInfoService : IShopInfoService
{
private readonly IShopInfoRepository _shopInfoRepository;
public ShopInfoService(IShopInfoRepository shopInfoRepository)
{
_shopInfoRepository = shopInfoRepository;
}
public async Task<PublicShopInfoDto> GetPublicShopInfoAsync()
{
var shopInfo = await _shopInfoRepository.GetAsync();
if (shopInfo == null)
{
// Gib Standardwerte zurück, wenn nichts konfiguriert ist
return new PublicShopInfoDto { ShopName = "Webshop" };
}
return new PublicShopInfoDto
{
ShopName = shopInfo.ShopName,
Slogan = shopInfo.Slogan,
ContactEmail = shopInfo.ContactEmail,
PhoneNumber = shopInfo.PhoneNumber,
Street = shopInfo.Street,
City = shopInfo.City,
PostalCode = shopInfo.PostalCode,
Country = shopInfo.Country,
FacebookUrl = shopInfo.FacebookUrl,
InstagramUrl = shopInfo.InstagramUrl,
TwitterUrl = shopInfo.TwitterUrl
};
}
}
}