Ejemplo n.º 1
0
        public Forum GetById(int id)
        {
            SharePointListItem currentItem = Provider.GetListItemByField(ForumConstants.Lists_Forums, "ID", id.ToString());

            if (currentItem == null)
            {
                return(new Forum(id, 1, "Default Forum"));
            }

            return(ForumMapper.CreateDomainObject(currentItem));
        }
Ejemplo n.º 2
0
        public IList <Forum> FindByCategoryId(int id)
        {
            SharePointListDescriptor descriptor      = Provider.GetListItemsByField(ForumConstants.Lists_Forums, "CategoryID", id.ToString());
            IList <Forum>            forumCollection = new List <Forum>();

            foreach (SharePointListItem listItem in descriptor.SharePointListItems)
            {
                forumCollection.Add(ForumMapper.CreateDomainObject(listItem));
            }

            return(forumCollection);
        }
Ejemplo n.º 3
0
        public IList <Forum> GetAll()
        {
            SharePointListDescriptor descriptor      = Provider.GetAllListItems(ForumConstants.Lists_Forums);
            IList <Forum>            forumCollection = new List <Forum>();

            foreach (SharePointListItem listItem in descriptor.SharePointListItems)
            {
                forumCollection.Add(ForumMapper.CreateDomainObject(listItem));
            }

            return(forumCollection);
        }
Ejemplo n.º 4
0
        public int Save(Forum forum)
        {
            SharePointListItem listItem = ForumMapper.CreateDto(forum);
            int newId = 0;

            if (forum.Id == 0)
            {
                newId = Provider.AddListItem(ForumConstants.Lists_Forums, listItem);
                SetupDefaultPermissions(newId);
            }
            else
            {
                newId = Provider.UpdateListItem(ForumConstants.Lists_Forums, listItem);
            }

            return(newId);
        }