Example #1
0
        /// <summary>
        /// Creates the domain object.
        /// </summary>
        /// <param name="listItem">The list item.</param>
        /// <returns></returns>
        public static Category CreateDomainObject(SharePointListItem listItem)
        {
            Category category = new Category(listItem.Id, listItem["Title"]);

            category.SortOrder = Convert.ToInt32(listItem["SortOrder"]);

            return category;
        }
Example #2
0
        /// <summary>
        /// Creates the dto.
        /// </summary>
        /// <param name="category">The category.</param>
        /// <returns></returns>
        public static SharePointListItem CreateDto(Category category)
        {
            string[] values = {
				"Title", category.Name,
				"SortOrder", category.SortOrder.ToString(),
			};

            return new SharePointListItem(category.Id, values);
        }
Example #3
0
        /// <summary>
        /// Saves the specified category.
        /// </summary>
        /// <param name="category">The category.</param>
        /// <returns></returns>
        public int Save(Category category)
        {
            SharePointListItem listItem = CategoryMapper.CreateDto(category);
            int categoryId;

            if (listItem.Id == 0)
                categoryId = Provider.AddListItem(ForumConstants.Lists_Category, listItem);
            else
                categoryId = Provider.UpdateListItem(ForumConstants.Lists_Category, listItem);

            return categoryId;
        }
Example #4
0
 public int Save(Category category)
 {
     return _dao.Save(category);
 }