43 lines
1.4 KiB
C#
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
|
|
};
|
|
}
|
|
}
|
|
} |