refactor(giving): use AnyAsync in category seed (code-review minor)
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using ROLAC.API.Entities;
|
using ROLAC.API.Entities;
|
||||||
|
|
||||||
namespace ROLAC.API.Data;
|
namespace ROLAC.API.Data;
|
||||||
@@ -50,7 +51,7 @@ public static class DbSeeder
|
|||||||
{
|
{
|
||||||
foreach (var (en, zh, sort) in GivingCategorySeed)
|
foreach (var (en, zh, sort) in GivingCategorySeed)
|
||||||
{
|
{
|
||||||
if (!db.GivingCategories.Any(c => c.Name_en == en))
|
if (!await db.GivingCategories.AnyAsync(c => c.Name_en == en))
|
||||||
{
|
{
|
||||||
db.GivingCategories.Add(new GivingCategory
|
db.GivingCategories.Add(new GivingCategory
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user