Exemplo n.º 1
0
        public void EditGroup(int id, ReaderGroup newGroup)
        {
            var group = GetGroup(id);

            newGroup.CopyProperties <ReaderGroup>(group,
                                                  g => g.Name,
                                                  g => g.Description,
                                                  g => g.Public,
                                                  g => g.Closed);
            SaveChanges();
        }
Exemplo n.º 2
0
        public void AddGroupForUser(ReaderGroup group, string userName)
        {
            var user     = GetCurrentUser(userName);
            var newGroup = new ReaderGroup();

            group.CopyProperties <ReaderGroup>(newGroup,
                                               g => g.Public,
                                               g => g.Name,
                                               g => g.Themes,
                                               g => g.Description,
                                               g => g.Closed);
            newGroup.Admins  = new List <User>(new User[] { user });
            newGroup.Members = new List <User>(new User[] { user });
            newGroup.Owner   = user;
            Ctx.ReaderGroups.Add(newGroup);
            SaveChanges();
        }