26 lines
1.0 KiB
C#
26 lines
1.0 KiB
C#
using FruitBank.Common.Entities;
|
|
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 CargoTruckDbTable : MgDbTableBase<CargoTruck>
|
|
{
|
|
public CargoTruckDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings)
|
|
: base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings)
|
|
{
|
|
}
|
|
|
|
public override IOrderedQueryable<CargoTruck> GetAll() => base.GetAll().OrderBy(p => p.CargoPartnerId);
|
|
|
|
public IQueryable<CargoTruck> GetAll(bool loadRelations)
|
|
{
|
|
return GetAll();
|
|
//return loadRelations ? GetAll().LoadWith(sd => sd.CargoTrucks) : GetAll();
|
|
}
|
|
|
|
public Task<CargoTruck> GetByIdAsync(int id, bool loadRelations) => GetAll(loadRelations).FirstOrDefaultAsync(p => p.Id == id);
|
|
} |