コード例 #1
0
        public ActionResult AddNewCategory(int postid, string catName, string catDesc) //string catUrlSeo,
        {
            var result        = RedirectToAction("CategoriesAndTags", "Forum", new { Message = "CategoryExist" });
            var CheckCategory = _dbhelpers.FindCategoty(catName);

            //chech if category with suck name already exists
            if (CheckCategory == null)
            {
                if (postid != 0)
                {
                    _forumFunctions.AddNewCategory(catName, catDesc); //catUrlSeo,
                    return(RedirectToAction("AddCategoryToPost", new { postid = postid }));
                }
                else
                {
                    _forumFunctions.AddNewCategory(catName, catDesc); //catUrlSeo,
                    return(RedirectToAction("CategoriesAndTags", "Forum"));
                }
            }
            else
            {
                return(result);
            }
        }