Ejemplo n.º 1
0
        public static void Initialize(DTSLocalDBContext context)
        {
            context.Database.EnsureCreated();

            // Look for any students.
            if (context.User.Any())
            {
                return;   // DB has been seeded
            }

            var templateStates = new TemplateState[]
            {
                new TemplateState {
                    State = "Active"
                },
                new TemplateState {
                    State = "Inactive"
                }
            };

            foreach (var templateState in templateStates)
            {
                context.TemplateState.Add(templateState);
            }

            var types = new UserType[]
            {
                new UserType {
                    Name = "Admin"
                },
                new UserType {
                    Name = "Editor"
                },
                new UserType {
                    Name = "User"
                }
            };

            foreach (var type in types)
            {
                context.UserType.Add(type);
            }

            context.SaveChanges();

            var statuses = new UserStatus[]
            {
                new UserStatus {
                    Name = "Active"
                },
                new UserStatus {
                    Name = "Suspended"
                },
                new UserStatus {
                    Name = "Blocked"
                }
            };

            foreach (var status in statuses)
            {
                context.UserStatus.Add(status);
            }


            var users = new User[]
            {
                new User {
                    Name = "Bartłomiej", Surname = "Żądło", Email = "*****@*****.**", Login = "******", Password = "******", Type = types[1], Status = statuses[0]
                },
                new User {
                    Name = "Magda", Surname = "Kiebała", Email = "*****@*****.**", Login = "******", Password = "******", Type = types[2], Status = statuses[0]
                },
                new User {
                    Name = "Piotrek", Surname = "Kamiński", Email = "*****@*****.**", Login = "******", Password = "******", Type = types[0], Status = statuses[0]
                },
            };

            foreach (var user in users)
            {
                context.User.Add(user);
            }
            context.SaveChanges();
        }
 public UserStatusRepository(DTSLocalDBContext DtsContext)
     : base(DtsContext)
 {
 }
Ejemplo n.º 3
0
 public TemplateStateRepository(DTSLocalDBContext DtsContext)
     : base(DtsContext)
 {
 }
 public RepositoryAsync(DTSLocalDBContext DtsContext)
 {
     this.DTSContext = DtsContext;
 }
Ejemplo n.º 5
0
 public UserTypeRepository(DTSLocalDBContext DtsContext)
     : base(DtsContext)
 {
 }
 public TemplateVersionRepository(DTSLocalDBContext DtsContext)
     : base(DtsContext)
 {
 }
 public RepositoryWrapper(DTSLocalDBContext DtsContext)
 {
     this._context = DtsContext;
 }