示例#1
0
        public void RegisterPresence(User user)
        {
            this.presences.Add(new Presence
            {
                RegisteredOn = DateTime.Now,
                User = user,
            });

            this.presences.SaveChanges();
        }
        public static InMemoryRepository<User> GetUsersRepository(int usersCount = 20)
        {
            var repository = new InMemoryRepository<User>();

            for (int i = 0; i < usersCount; i++)
            {
                var user = new User()
                {
                    Id = i.ToString(),
                    UserName = "******" + i,
                    FirstName = "User" + i,
                    LastName = "User lastName"  + i,
                    AvatarUrl = "Avatar" + i
                };

                repository.Add(user);
            }

            return repository;
        }