shop info
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
// src/Webshop.Application/Services/Public/IShopInfoService.cs
|
||||
using System.Threading.Tasks;
|
||||
using Webshop.Application.DTOs.Shop;
|
||||
|
||||
namespace Webshop.Application.Services.Public
|
||||
{
|
||||
public interface IShopInfoService
|
||||
{
|
||||
Task<PublicShopInfoDto> GetPublicShopInfoAsync();
|
||||
}
|
||||
}
|
||||
43
Webshop.Application/Services/Public/ShopInfoService.cs
Normal file
43
Webshop.Application/Services/Public/ShopInfoService.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
// 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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user