Esempio n. 1
0
        private void SeedUsers(AngeDbContext context)
        {
            var users = new[]
            {
                new User {
                    Id = User1, Name = "User1", Country = "Paraguay"
                },
                new User {
                    Id = User2, Name = "User2", Country = "Tuvalu"
                },
            };

            context.Users.AddRange(users);
            context.SaveChanges();
        }
Esempio n. 2
0
        private void SeedMessages(AngeDbContext context)
        {
            var messages = new[]
            {
                new ChatMessage
                {
                    Id          = new Guid("00305EDD-7EEA-46BD-8DD6-AD0C2483F3E1"),
                    RoomId      = Room1,
                    AuthorId    = User1,
                    SentTime    = DateTime.UtcNow,
                    Type        = MessageType.Text,
                    MessageText = "A note to self."
                },
                new ChatMessage
                {
                    Id          = new Guid("DC698673-79ED-49A5-9813-46AA1B10F8C3"),
                    RoomId      = Room2,
                    AuthorId    = User2,
                    SentTime    = DateTime.UtcNow,
                    Type        = MessageType.Text,
                    MessageText = "Something."
                },
                new ChatMessage
                {
                    Id          = new Guid("3A56F844-16B1-481F-8C9A-ECBF10F0F0B5"),
                    RoomId      = Room3,
                    AuthorId    = User1,
                    SentTime    = DateTime.UtcNow,
                    Type        = MessageType.Text,
                    MessageText = "Message from user1 to user2."
                },
                new ChatMessage
                {
                    Id          = new Guid("DB31F61C-4781-48AC-A98E-0C248475EDE1"),
                    RoomId      = Room3,
                    AuthorId    = User2,
                    SentTime    = DateTime.UtcNow,
                    Type        = MessageType.Text,
                    MessageText = "Message from user2 to user1."
                },
            };

            context.AddRange(messages);
            context.SaveChanges();
        }
Esempio n. 3
0
        private void SeedUserRooms(AngeDbContext context)
        {
            var ur = new[]
            {
                new UserRoom {
                    UserId = User1, RoomId = Room1
                },
                new UserRoom {
                    UserId = User2, RoomId = Room2
                },
                new UserRoom {
                    UserId = User1, RoomId = Room3
                },
                new UserRoom {
                    UserId = User2, RoomId = Room3
                },
            };

            context.UserRooms.AddRange(ur);
            context.SaveChanges();
        }
Esempio n. 4
0
        private void SeedRooms(AngeDbContext context)
        {
            var rooms = new[]
            {
                new Room
                {
                    Id          = Room1, Title = "PersonalRoom1",
                    RoomCreator = User1, Type = RoomType.Personal
                },
                new Room
                {
                    Id          = Room2, Title = "PersonalRoom2",
                    RoomCreator = User2, Type = RoomType.Personal
                },
                new Room
                {
                    Id          = Room3, Title = "PublicRoom",
                    RoomCreator = User1, Type = RoomType.Public
                },
            };

            context.Rooms.AddRange(rooms);
            context.SaveChanges();
        }