Adding
This commit is contained in:
+19
@@ -0,0 +1,19 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using LCU.Library.Internal.DataCleanUpModel.Entities;
|
||||
|
||||
namespace LCU.Api.Internal.DataCleanUpLib.Extensions
|
||||
{
|
||||
public static class QueryableExcludeMinorAccountType
|
||||
{
|
||||
public static IQueryable<Ltv_DataCleanUp> ExcludeMinorAccountType(this IQueryable<Ltv_DataCleanUp> queryable, List<string> listExcludedMinorAccountTypes)
|
||||
{
|
||||
if (listExcludedMinorAccountTypes == null || !listExcludedMinorAccountTypes.Any())
|
||||
{
|
||||
return queryable;
|
||||
}
|
||||
|
||||
return queryable.Where(ltv_DataCleanUp => !listExcludedMinorAccountTypes.Contains(ltv_DataCleanUp.MinorType));
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="EntityFramework" Version="6.4.4" />
|
||||
<PackageReference Include="LCU.Library.Internal.CoreApiWrapperModel" Version="2.27.14" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.17" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.17" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\LCU.Library.Internal.DataCleanUpModel\LCU.Library.Internal.DataCleanUpModel.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
using LCU.Library.Internal.DataCleanUpModel.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LCU.Api.Internal.DataCleanUpLib.Persistence
|
||||
{
|
||||
public class AppDbContext : DbContext
|
||||
{
|
||||
public DbSet<Ltv_DataCleanUp> LtvDataCleanUp { get; set; }
|
||||
|
||||
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options) { }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
base.OnModelCreating(builder);
|
||||
builder.Entity<Ltv_DataCleanUp>().ToTable("LTV_DataCleanUp");
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
using LCU.Api.Internal.DataCleanUpLib.Persistence;
|
||||
|
||||
namespace LCU.Api.Internal.DataCleanUpLib.Repositories
|
||||
{
|
||||
public abstract class BaseRepository
|
||||
{
|
||||
protected readonly AppDbContext _context;
|
||||
|
||||
public BaseRepository(AppDbContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.Library.Internal.DataCleanUpModel.Entities;
|
||||
|
||||
namespace LCU.Api.Internal.DataCleanUpLib.Repositories
|
||||
{
|
||||
public interface ILtvDataCleanUpRepository
|
||||
{
|
||||
Task<IEnumerable<Ltv_DataCleanUp>> ListMinorAccountTypeAsync(List<string> listExcludedMinorTypes);
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.Api.Internal.DataCleanUpLib.Extensions;
|
||||
using LCU.Library.Internal.DataCleanUpModel.Entities;
|
||||
using LCU.Api.Internal.DataCleanUpLib.Persistence;
|
||||
|
||||
namespace LCU.Api.Internal.DataCleanUpLib.Repositories
|
||||
{
|
||||
public class LtvDataCleanUpRepository : BaseRepository, ILtvDataCleanUpRepository
|
||||
{
|
||||
public LtvDataCleanUpRepository(AppDbContext context) : base(context) { }
|
||||
|
||||
public async Task<IEnumerable<Ltv_DataCleanUp>> ListMinorAccountTypeAsync(List<string> listExcludedMinorAccountTypes)
|
||||
{
|
||||
return await _context.LtvDataCleanUp.ExcludeMinorAccountType(listExcludedMinorAccountTypes).ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user