37 lines
1010 B
C#
37 lines
1010 B
C#
using DataProviders;
|
|
using DomainResults.Common;
|
|
|
|
using WeatherForecast.Models.Requests;
|
|
using WeatherForecast.Models.Responses;
|
|
|
|
namespace WeatherForecast.Services {
|
|
|
|
public interface IShopCartItemsService {
|
|
(GetShopCartItemsResponseModel?, IDomainResult) Get(Guid siteId, Guid userId);
|
|
}
|
|
|
|
public class ShopCartItemsService : IShopCartItemsService {
|
|
|
|
ILogger<ShopCartItemsService> _logger;
|
|
IShopCartDataProvider _shopCartDataProvider;
|
|
|
|
public ShopCartItemsService(
|
|
ILogger<ShopCartItemsService> logger,
|
|
IShopCartDataProvider shopCartDataprovider
|
|
) {
|
|
_logger = logger;
|
|
_shopCartDataProvider = shopCartDataprovider;
|
|
}
|
|
|
|
public (GetShopCartItemsResponseModel?, IDomainResult) Get(Guid siteId, Guid userId) {
|
|
|
|
var (items, result) = _shopCartDataProvider.GetAll(siteId, userId);
|
|
|
|
if (!result.IsSuccess || items == null)
|
|
return (null, result);
|
|
|
|
return IDomainResult.Success(new GetShopCartItemsResponseModel(items));
|
|
}
|
|
}
|
|
}
|