30 lines
897 B
C#
30 lines
897 B
C#
using Microsoft.Extensions.Logging;
|
|
|
|
using DomainResults.Common;
|
|
|
|
using MongoDB.Bson.Serialization;
|
|
using MongoDB.Driver;
|
|
|
|
using DataProviders.Abstractions;
|
|
using Core.DomainObjects.Documents;
|
|
|
|
namespace DataProviders {
|
|
|
|
public interface IShopCartDataProvider {
|
|
(List<ShopCart>?, IDomainResult) Get(Guid siteId, Guid userId);
|
|
}
|
|
|
|
public class ShopCartDataProvider : DataProviderBase<ShopCart>, IShopCartDataProvider {
|
|
private const string _collectionName = "shopcart";
|
|
public ShopCartDataProvider(
|
|
ILogger<DataProviderBase<ShopCart>> logger,
|
|
IMongoClient client,
|
|
IIdGenerator idGenerator,
|
|
ISessionService sessionService) : base(logger, client, idGenerator, sessionService) {
|
|
}
|
|
|
|
public (List<ShopCart>?, IDomainResult) Get(Guid siteId, Guid userId) =>
|
|
GetWithPredicate(x => x.SiteId == siteId && x.UserId == userId, _collectionName);
|
|
}
|
|
}
|