39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
using DataProviders;
|
|
using DomainResults.Common;
|
|
using ExtensionMethods;
|
|
using WeatherForecast.Models.Responses;
|
|
|
|
namespace WeatherForecast.Services {
|
|
|
|
public interface IContentService {
|
|
(GetContentResponseModel?, IDomainResult) GetContent(Guid siteId, string? locale);
|
|
}
|
|
|
|
public class ContentService : IContentService {
|
|
|
|
private readonly ILogger<ContentService> _logger;
|
|
private readonly IContentDataProvider _contentDataProvider;
|
|
|
|
public ContentService(
|
|
ILogger<ContentService> logger,
|
|
IContentDataProvider contentDataprovider
|
|
) {
|
|
_logger = logger;
|
|
_contentDataProvider = contentDataprovider;
|
|
}
|
|
|
|
public (GetContentResponseModel?, IDomainResult) GetContent(Guid siteId, string? locale) {
|
|
var (content, result) = _contentDataProvider.Get("b3f39a82-6a1b-46a4-85cc-04c3b4315511".ToGuid());
|
|
|
|
if (!result.IsSuccess)
|
|
return (null, result);
|
|
|
|
// map content to GetContentResponseModel
|
|
|
|
return IDomainResult.Failed<GetContentResponseModel?>();
|
|
}
|
|
}
|
|
|
|
|
|
}
|