public void SeedData()
        {
            // create user
            var user = new FriendbookUser
            {
                Id      = Guid.NewGuid(),
                Friends = new List <FriendbookUser>(),
                Name    = Faker.Name.FullName()
            };

            _context.FriendBookUsers.Add(user);
            _context.SaveChanges();

            // create update
            var update = new Update
            {
                Id         = Guid.NewGuid(),
                Body       = Faker.Lorem.Paragraph(1),
                User       = user,
                PostedDate = DateTime.Now
            };

            _context.FriendBookUpdates.Add(update);
            _context.SaveChanges();
        }
Exemplo n.º 2
0
 private dynamic MapUser(FriendbookUser user)
 {
     return(new
     {
         Friends = user.Friends.Select(f => f.Id),
         Name = user.Name,
         Type = "User"
     });
 }
Exemplo n.º 3
0
        // end::GetTenLatestUpdates[]

        public void SeedData()
        {
            // create user
            var userId = Guid.NewGuid().ToString();
            var user   = new FriendbookUser
            {
                Friends = new List <FriendbookUser>(),
                Name    = Faker.Name.FullName()
            };

            _bucket.Insert(new Document <dynamic>
            {
                Id      = userId,
                Content = new
                {
                    Friends = new List <dynamic>(),
                    Name    = user.Name,
                    Type    = "User"
                }
            });

            // create update
            var update = new Update
            {
                Body       = Faker.Lorem.Paragraph(1),
                User       = user,
                PostedDate = DateTime.Now
            };

            _bucket.Insert(new Document <dynamic>
            {
                Id      = Guid.NewGuid().ToString(),
                Content = new
                {
                    Body       = update.Body,
                    PostedDate = update.PostedDate,
                    User       = userId,
                    Type       = "Update"
                }
            });
        }