Exemplo n.º 1
0
        private static void CreateDummyUsers(int NumOfUsers)
        {
            Role lDummyRole = new Role() { Name = "User" };
            using (VideoStoreEntityModelContainer lContainer = new VideoStoreEntityModelContainer())
            {
                if (lContainer.Users.Count() > NumOfUsers + 1)
                {
                    return;
                }
            }
            for (int i = 0; i < NumOfUsers; i++ )
            {

                User pUser = new User()
                {
                    Name = lDummyRole.Name + i.ToString(),
                    LoginCredential = new LoginCredential() { UserName = lDummyRole.Name + i.ToString(), Password = "******" },
                    Email = lDummyRole.Name + i.ToString() + "@Dummy.com",
                    Address = "1 Central Park"
                };

                pUser.Roles.Add(lDummyRole);

                ServiceLocator.Current.GetInstance<IUserProvider>().CreateUser(pUser);
            }
        }
Exemplo n.º 2
0
        private static void CreateOperator()
        {
            Role lOperatorRole = new Role() { Name = "Operator" };
            using (VideoStoreEntityModelContainer lContainer = new VideoStoreEntityModelContainer())
            {
                if (lContainer.Roles.Count() > 0)
                {
                    return;
                }
            }
            User lOperator = new User()
            {
                Name = "Operator",
                LoginCredential = new LoginCredential() { UserName = "******", Password = "******" },
                Email = "*****@*****.**",
                Address = "1 Central Park"
            };

            lOperator.Roles.Add(lOperatorRole);

            ServiceLocator.Current.GetInstance<IUserProvider>().CreateUser(lOperator);
        }