34 lines
650 B
C#
34 lines
650 B
C#
![]() |
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using TodoApp.API.Models;
|
|||
|
|
|||
|
namespace TodoApp.API.Data
|
|||
|
{
|
|||
|
public class TodoAppDataSeeder
|
|||
|
{
|
|||
|
|
|||
|
public static void Initialize(TodoAppContext context)
|
|||
|
{
|
|||
|
|
|||
|
if (context.TodoItems.Any())
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
context.TodoItems.AddRange(
|
|||
|
new TodoItem
|
|||
|
{
|
|||
|
Name = "Test",
|
|||
|
Done = false,
|
|||
|
Description = "Test"
|
|||
|
}
|
|||
|
);
|
|||
|
|
|||
|
context.SaveChanges();
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|