Exemplo n.º 1
0
        public void AddUser(string cod, string name)
        {
            User user = new User(cod, name);

            Users.AddLast(user);
            SaveUser(user);
        }
Exemplo n.º 2
0
        private void GenerateUsers()
        {
            UserState New()
            {
                string GenerateRandomName() =>
                $"{RandomGenerationData.LasttNameList[RandomGenerationData.Random.Next(RandomGenerationData.LasttNameList.Count)]} {RandomGenerationData.SurNameList[RandomGenerationData.Random.Next(RandomGenerationData.SurNameList.Count)]}";

                return(new UserState {
                    Id = Guid.NewGuid(),
                    Image = new Uri(RandomGenerationData.ProfileList[RandomGenerationData.Random.Next(RandomGenerationData.ProfileList.Count)]),
                    Gender = RandomGenerationData.Random.Next(2) > 0 ? Gender.Female : Gender.Male,
                    ObtainedCredits = RandomGenerationData.Random.Next(100),
                    Name = GenerateRandomName(),
                    PreferedLanguage = RandomGenerationData.Random.Next(2) > 0 ? Language.English : Language.Mandarin,
                    Region = RandomGenerationData.Random.Next(2) > 0 ? Region.HongKong : Region.MainlandChina,
                    University = RandomGenerationData.UniversityList[RandomGenerationData.Random.Next(RandomGenerationData.UniversityList.Count)],
                    Articles = new List <ArticleSummary>()
                });
            }

            for (var i = 0; i < UserNumber; i++)
            {
                Users.AddLast(New());
            }
        }