Add accounts page

This commit is contained in:
2025-11-27 09:37:18 +09:00
parent 28cfe99c78
commit bca845296a
11 changed files with 164 additions and 47 deletions

View File

@ -0,0 +1,30 @@
using EFCore.BulkExtensions;
using Hcs.WebApp.Data.Hcs;
using Microsoft.EntityFrameworkCore;
namespace Hcs.WebApp.Services
{
public class AccountService(IDbContextFactory<HcsDbContext> factory) : HcsServiceBase(factory)
{
public async Task<IEnumerable<Account>> GetAllAccountsAsync()
{
using var context = GetNewContext();
return await context.Accounts.ToListAsync();
}
public async Task UpsertAccounts(HcsDbContext context, IEnumerable<Account> accounts)
{
await context.BulkInsertOrUpdateAsync(accounts, new BulkConfig()
{
PropertiesToExcludeOnUpdate =
[
nameof(SupplyContract.ThirdPartyId)
],
UpdateByProperties =
[
nameof(SupplyContract.HcsId)
]
});
}
}
}