コード例 #1
0
        public static void DummyUsers(Context context)
        {
            var legal0 = new LegalInformation("name3", "surname3", "1234269890");
            var city0 = new City() { Country = "Poland", Name = "Katowice", State = "Śląsk" };
            var address0 = new Address("some street whateve434r", "12-650", city0.Name, city0.State, city0.Country);
            var properties0 = new Dictionary<string, object>()
            {
                {"email", "*****@*****.**"},
                {"password", "dupaDupa2!"},
                {"phoneNumber", "123496389"},
                {"isRegistered", true},
                {"role", Role.Admin},
                {"address", address0},
                {"legal", legal0}
            };

            var city1 = new City() { Country = "Poland", Name = "Katowice", State = "Śląsk" };
            var address1 = new Address("some street whatever", "12-654", city1.Name, city1.State, city1.Country);
            var legal1 = new LegalInformation("name", "surname", "12345678901");
            var properties1 = new Dictionary<string, object>()
            {
                {"email", "*****@*****.**"},
                {"password", "dupaDupa2!"},
                {"phoneNumber", "123456789"},
                {"isRegistered", true},
                {"role", Role.Reader},
                {"address", address1},
                {"legal", legal1}
            };

            var city2 = new City() { Country = "Polska", Name = "Gliwice", State = "Górny Śląsk" };
            var address2 = new Address("some street whatever", "12-654", city2.Name, city2.State, city2.Country);
            var legal2 = new LegalInformation("name", "surname", "12345678901");
            var properties2 = new Dictionary<string, object>()
            {
                {"email", "*****@*****.**"},
                {"password", "dupaDupa2!"},
                {"phoneNumber", "123456789"},
                {"isRegistered", true},
                {"role", Role.Librarian},
                {"address", address2},
                {"legal", legal2}
            };

            var user0 = UserFactory.CreateUser(properties0);
            context.GetRepository<User>().Save(user0);

            var user1 = UserFactory.CreateUser(properties1);
            context.GetRepository<User>().Save(user1);

            var user2 = UserFactory.CreateUser(properties2);
            context.GetRepository<User>().Save(user2);
        }
コード例 #2
0
 public User(string email, string password, string phoneNumber, bool isRegistered, Role role, Address address, City city,
     LegalInformation legal)
 {
     Email = email;
     PhoneNumber = phoneNumber;
     Password = password;
     IsRegistered = isRegistered;
     Role = role;
     Name = legal.Name;
     Surname = legal.Surname;
     PESEL = legal.PESEL;
     AddressLine = address.AddressLine;
     PostalCode = address.PostalCode;
     City = city;
 }