31 lines
1.2 KiB
C#
31 lines
1.2 KiB
C#
using FruitBank.Common.Entities;
|
|
using LinqToDB;
|
|
using Mango.Nop.Data.Repositories;
|
|
using Nop.Core.Caching;
|
|
using Nop.Core.Configuration;
|
|
using Nop.Core.Events;
|
|
using Nop.Data;
|
|
|
|
namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer;
|
|
|
|
public class StockTakingItemDbTable : MgDbTableBase<StockTakingItem>
|
|
{
|
|
public StockTakingItemDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings)
|
|
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
|
|
{
|
|
}
|
|
|
|
public override IQueryable<StockTakingItem> GetAll() => base.GetAll();
|
|
|
|
public IQueryable<StockTakingItem> GetAll(bool loadRelations)
|
|
{
|
|
return loadRelations
|
|
? GetAll()
|
|
.LoadWith(sti => sti.StockTaking)
|
|
//.LoadWith(sti => sti.StockTakingItemPallets)
|
|
.LoadWith(sti => sti.Product).ThenLoad(prod => prod.GenericAttributes)
|
|
: GetAll();
|
|
}
|
|
|
|
public Task<StockTakingItem> GetByIdAsync(int stockTakingItemId, bool loadRelations) => GetAll(loadRelations).FirstOrDefaultAsync(sti => sti.Id == stockTakingItemId);
|
|
} |