public JsonResult _EditSiteCategory(CategoryEditModel category)
        {
            //添加
            if (category.CategoryId == 0)
            {
                Category _category = category.AsCategory();
                _category.AuditStatus = AuditStatus.Success;

                var result = categoryService.Create(_category);
                if (result)
                {
                    return(Json(new StatusMessageData(StatusMessageType.Success, "添加成功!")));
                }
                else
                {
                    return(Json(new StatusMessageData(StatusMessageType.Error, "添加失败!")));
                }
            }
            //编辑
            else
            {
                categoryService.Update(category.AsCategory());

                return(Json(new StatusMessageData(StatusMessageType.Success, "编辑成功!")));
            }
        }
        public ActionResult _EditSiteCategory(string tenantTypeId = null, long categoryId = 0, long parentId = 0)
        {
            CategoryEditModel categoryEditModel = new CategoryEditModel();

            //编辑
            if (categoryId != 0)
            {
                Category category = categoryService.Get(categoryId);
                categoryEditModel = category.AsCategoryEditModel();
            }
            else
            {
                if (!string.IsNullOrEmpty(tenantTypeId))
                {
                    categoryEditModel.TenantTypeId = tenantTypeId;
                }
                if (parentId != 0)
                {
                    Category category = categoryService.Get(parentId);
                    categoryEditModel.Depth      = category.Depth + 1;
                    categoryEditModel.ParentId   = parentId;
                    categoryEditModel.ParentName = category.CategoryName;
                }
            }
            return(View(categoryEditModel));
        }
        public ActionResult _EditUserCategory(long categoryId = 0)
        {
            //编辑
            Category          category          = categoryService.Get(categoryId);
            CategoryEditModel categoryEditModel = category.AsCategoryEditModel();

            return(View(categoryEditModel));
        }
        public ActionResult _MoveSiteCategory(long fromCategoryId = 0, string option = "move")
        {
            CategoryEditModel categoryEditModel = new CategoryEditModel();
            int maxDepth = 0;

            if (fromCategoryId != 0)
            {
                Category category = categoryService.Get(fromCategoryId);
                categoryEditModel = category.AsCategoryEditModel();
                maxDepth          = category.MaxDepth;
            }
            ViewData["option"]   = option;
            ViewData["maxDepth"] = maxDepth;
            return(View(categoryEditModel));
        }
        public ActionResult _EditThreadCategoryPost(CategoryEditModel model)
        {
            if (!authorizer.BarSection_Manage(model.OwnerId))
            {


                return Json(new StatusMessageData(StatusMessageType.Error, "没有权限"));
            }

            string errorMessage = string.Empty;
            if (ModelState.HasBannedWord(out errorMessage))
            {
                return Json(new StatusMessageData(StatusMessageType.Error, errorMessage));
            }

            BarSection section = barSectionService.Get(model.OwnerId);

            if (section == null)
                return Json(new StatusMessageData(StatusMessageType.Error, "创建分类失败"));

            model.TenantTypeId = TenantTypeIds.Instance().BarThread();
            Category category = model.AsCategory();
            if (model.CategoryId != 0)
            {
                categoryService.Update(category);
                return Json(new StatusMessageData(StatusMessageType.Success, "更新分类成功"));
            }
            else
            {
                bool isCreat = categoryService.Create(category);
                if (isCreat)
                    return Json(new StatusMessageData(StatusMessageType.Success, "创建分类成功"));



                return Json(new StatusMessageData(StatusMessageType.Error, "创建分类失败"));
            }

        }
        public ActionResult _EditThreadCategory(long OwnerId, long? CategoryId = null)
        {
            CategoryEditModel model = new CategoryEditModel();

            if (CategoryId.HasValue)
            {
                Category category = categoryService.Get(CategoryId ?? 0);
                if (category != null)
                    model = category.AsCategoryEditModel();
            }

            model.OwnerId = OwnerId;
            return View(model);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 编辑我的用户分类页
 /// </summary>
 public ActionResult _EditMyCategory(string spaceKey, long categoryId, string tenantTypeId = "")
 {
     CategoryEditModel categoryEditModel = new CategoryEditModel();
     categoryEditModel.CategoryId = categoryId;
     if (categoryId > 0)
     {
         Category category = categoryService.Get(categoryId);
         if (category == null)
             return HttpNotFound();
         categoryEditModel.CategoryName = category.CategoryName;
     }
     return View(categoryEditModel);
 }
Ejemplo n.º 8
0
 public ActionResult _EditMyCategory(string spaceKey, CategoryEditModel categoryEditModel)
 {
     IUser currentUser = UserContext.CurrentUser;
     if (currentUser != null && categoryEditModel.CategoryId > 0 && !string.IsNullOrEmpty(categoryEditModel.CategoryName))
     {
         Category category = categoryService.Get(categoryEditModel.CategoryId);
         category.CategoryName = categoryEditModel.CategoryName;
         categoryService.Update(category);
         return Json(new { MessageType = StatusMessageType.Success, MessageContent = "更新成功!" }, JsonRequestBehavior.AllowGet);
     }
     else
     {
         return Json(new StatusMessageData(StatusMessageType.Error, "更新失败!"), JsonRequestBehavior.AllowGet);
     }
 }
Ejemplo n.º 9
0
 public ActionResult _CreateMyCategory(string spaceKey, string tenantTypeId, CategoryEditModel categoryEditModel)
 {
     IUser currentUser = UserContext.CurrentUser;
     if (currentUser != null && !string.IsNullOrEmpty(categoryEditModel.CategoryName))
     {
         Category category = Category.New();
         category.CategoryName = categoryEditModel.CategoryName;
         category.OwnerId = currentUser.UserId;
         category.TenantTypeId = tenantTypeId;
         categoryService.Create(category);
         return Json(new { MessageType = StatusMessageType.Success, MessageContent = "创建成功!", CategoryId = category.CategoryId, CategoryName = category.CategoryName }, JsonRequestBehavior.AllowGet);
     }
     else
     {
         return Json(new StatusMessageData(StatusMessageType.Error, "创建失败!"), JsonRequestBehavior.AllowGet);
     }
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 创建用户分类页
 /// </summary>
 /// <returns></returns>
 public ActionResult _CreateMyCategory(string spaceKey, string tenantTypeId)
 {
     CategoryEditModel categoryEditModel = new CategoryEditModel();
     categoryEditModel.TenantTypeId = tenantTypeId;
     return View(categoryEditModel);
 }
Ejemplo n.º 11
0
 public ActionResult _MoveSiteCategory(long fromCategoryId = 0, string option = "move")
 {
     CategoryEditModel categoryEditModel = new CategoryEditModel();
     int maxDepth = 0;
     if (fromCategoryId != 0)
     {
         Category category = categoryService.Get(fromCategoryId);
         categoryEditModel = category.AsCategoryEditModel();
         maxDepth = category.MaxDepth;
     }
     ViewData["option"] = option;
     ViewData["maxDepth"] = maxDepth;
     return View(categoryEditModel);
 }
Ejemplo n.º 12
0
        public JsonResult _EditUserCategory(CategoryEditModel category)
        {
            categoryService.Update(category.AsCategory());

            return Json(new StatusMessageData(StatusMessageType.Success, "编辑成功!"));
        }
Ejemplo n.º 13
0
        public JsonResult _EditSiteCategory(CategoryEditModel category)
        {
            //添加
            if (category.CategoryId == 0)
            {
                Category _category = category.AsCategory();
                _category.AuditStatus = AuditStatus.Success;

                var result = categoryService.Create(_category);
                if (result)
                {
                    return Json(new StatusMessageData(StatusMessageType.Success, "添加成功!"));
                }
                else
                {
                    return Json(new StatusMessageData(StatusMessageType.Error, "添加失败!"));
                }
            }
            //编辑
            else
            {
                categoryService.Update(category.AsCategory());

                return Json(new StatusMessageData(StatusMessageType.Success, "编辑成功!"));
            }
        }
Ejemplo n.º 14
0
        public ActionResult _EditSiteCategory(string tenantTypeId = null, long categoryId = 0, long parentId = 0)
        {
            CategoryEditModel categoryEditModel = new CategoryEditModel();

            //编辑
            if (categoryId != 0)
            {
                Category category = categoryService.Get(categoryId);
                categoryEditModel = category.AsCategoryEditModel();
            }
            else
            {
                if (!string.IsNullOrEmpty(tenantTypeId))
                {
                    categoryEditModel.TenantTypeId = tenantTypeId;
                }
                if (parentId != 0)
                {
                    Category category = categoryService.Get(parentId);
                    categoryEditModel.Depth = category.Depth + 1;
                    categoryEditModel.ParentId = parentId;
                    categoryEditModel.ParentName = category.CategoryName;
                }

            }
            return View(categoryEditModel);
        }
        public JsonResult _EditUserCategory(CategoryEditModel category)
        {
            categoryService.Update(category.AsCategory());

            return(Json(new StatusMessageData(StatusMessageType.Success, "编辑成功!")));
        }
Ejemplo n.º 16
0
 /// <summary>
 /// 编辑用户分类
 /// </summary>
 /// <param name="category">分类实体</param>
 /// <returns></returns>
 public string _EditUserCategory(CategoryEditModel category)
 {
     return CachedUrlHelper.Action("_EditUserCategory", "ControlPanelContent", CommonAreaName, new RouteValueDictionary() { { "Category", category } });
 }