35 lines
1.3 KiB
C#
35 lines
1.3 KiB
C#
using Hncore.Infrastructure.Service;
|
|
using Hncore.Pass.Vpn.Domain;
|
|
using Hncore.Pass.Vpn.Model;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Hncore.Pass.Vpn.Service
|
|
{
|
|
public partial class ProductPackageService : ServiceBase<ProductPackageEntity>, IFindService
|
|
{
|
|
CourseContext m_DbContext;
|
|
ProductPackageUnitService m_ProductPackageUnitService;
|
|
public ProductPackageService(CourseContext dbContext
|
|
, ProductPackageUnitService _ProductPackageUnitService
|
|
, IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
|
{
|
|
m_DbContext = dbContext;
|
|
this.m_ProductPackageUnitService = _ProductPackageUnitService;
|
|
}
|
|
|
|
public async Task<List<PackageUnitItemModel>> GetBasePackages(int packageId)
|
|
{
|
|
var packageUnits = m_ProductPackageUnitService.Query(m => m.PackageId == packageId);
|
|
|
|
var query = from packageUnit in packageUnits
|
|
join package in this.Query(true) on packageUnit.BasePackageId equals package.Id
|
|
select new PackageUnitItemModel { Count = packageUnit.Count, Package = package };
|
|
return await query.ToListAsync();
|
|
}
|
|
}
|
|
}
|