Beispiel #1
0
        public Category SaveCategory(Category category)
        {
            if (category == null) throw new ArgumentNullException("category");
            if (string.IsNullOrEmpty(category.CategoryName) || string.IsNullOrEmpty(category.PageName)) return category;

            var i = Insert("wiki_categories")
                .InColumnValue("CategoryName", category.CategoryName)
                .InColumnValue("PageName", category.PageName);
            db.ExecuteNonQuery(i);
            return category;
        }
Beispiel #2
0
        public Category SaveCategory(Category category)
        {
            if (String.IsNullOrEmpty(category.CategoryName)) throw new ArgumentException(@"category name cannot be empty", "category");
            if (String.IsNullOrEmpty(category.PageName)) throw new ArgumentException(@"page name cannot be empty", "category");
            using (var dao = GetCategoryDAO())
            {
                var saved = dao.SaveCategory(category);

                if(saved != null) NotifyCategoryAdded(category.CategoryName, category.PageName);

                return saved;
            }
        }