Пример #1
0
        public static void TestAddUser()
        {
                var userRepository = new UserRepository();
                User user = new User();
                user.Id = "No.1";
                user.RealName = "mr111";
                user.AuthorityCategory = EnumUserCategory.Superman;
                user.RegisterName = "aswind";
                user.NickName = "被惊呆的小伙伴";
                user.Password = "******";
                user.Createtime = DateTime.Now;

                UserGroupRepository repository = new UserGroupRepository();
                UserGroup group=repository.FindByGroupTitle("R2Team");
               // UserGroup group1 = new UserGroup { Id = group.Id };
              //  userRepository.db.Entry(group1).State = EntityState.Unchanged;
               // user.ContentGroup = group1;
               // user.ContentGroup = new UserGroup();
                user.ContentGroupId = group.Id;
                userRepository.Add(user);
            }
Пример #2
0
 public static void TestAriticleInvisibility()
 {
     AriticleVisibility invis = new AriticleVisibility();
     invis.AriticleId = "1";
     UserGroupRepository repository = new UserGroupRepository();
     UserGroup group=repository.FindByGroupTitle("R2Team");
     invis.UserGroupId = group.Id;
     RRDLEntities db = new RRDLEntities();
     db.AriticleVisibilitys.Add(invis);
     db.SaveChanges();
     AriticleVisibilityRepository rep = new AriticleVisibilityRepository();
     //AriticleInvisibility arcInvis=rep.FindByAriticle("1");
    // db.AriticleInvisibilitys
 }