コード例 #1
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, "编辑成功!")));
            }
        }
コード例 #2
0
        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, "创建分类失败"));
            }

        }
コード例 #3
0
        public JsonResult _EditUserCategory(CategoryEditModel category)
        {
            categoryService.Update(category.AsCategory());

            return Json(new StatusMessageData(StatusMessageType.Success, "编辑成功!"));
        }
コード例 #4
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, "编辑成功!"));
            }
        }
コード例 #5
0
        public JsonResult _EditUserCategory(CategoryEditModel category)
        {
            categoryService.Update(category.AsCategory());

            return(Json(new StatusMessageData(StatusMessageType.Success, "编辑成功!")));
        }