summaryrefslogtreecommitdiffstats
path: root/src/Data/Seed.cs
blob: 03bcdb25e5b3698c677369fbb5d125c2a0255037 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections.Generic;
using IOL.Fagprove.Data.Enums;
using IOL.Fagprove.Data.Models;
using IOL.Fagprove.Utilities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace IOL.Fagprove.Data
{
    public class Seed
    {
        public class SeedUsers : IEntityTypeConfiguration<User>
        {
            public void Configure(EntityTypeBuilder<User> builder)
            {
                builder.HasData(new List<User>
                {
                    new User
                    {
                        Id = Guid.NewGuid(),
                        CreatedUtc = DateTime.UtcNow,
                        Email = "ivar@protektit.no",
                        Password = PasswordHasher.HashPassword("ivar123"),
                        Name = "Ivar Løvlie Administrator",
                        Role = UserRole.Administrator,
                    },
                    new User
                    {
                        Id = Guid.NewGuid(),
                        CreatedUtc = DateTime.UtcNow,
                        Email = "ivarino@protektit.no",
                        Password = PasswordHasher.HashPassword("ivar123"),
                        Name = "Ivar Løvlie Standard",
                        Role = UserRole.Basic,
                    }
                });
            }
        }
    }
}