public ActionResult _EditTagGroup(TagGroupEditModel tagGroupEditModel)
        {
            TagService             tagService = new TagService(tagGroupEditModel.TenantTypeId);
            IEnumerable <TagGroup> tagGroups  = tagService.GetGroups(tagGroupEditModel.TenantTypeId);

            if (tagGroups.Select(n => n.GroupName).Contains(tagGroupEditModel.GroupName))
            {
                return(Json(new StatusMessageData(StatusMessageType.Error, "已经存在相同的分组名称")));
                //return Json("same", JsonRequestBehavior.AllowGet);
            }
            //添加
            if (tagGroupEditModel.GroupId == 0)
            {
                tagService.CreateGroup(tagGroupEditModel.AsTagGroup());
            }//编辑
            else
            {
                tagService.UpdateGroup(tagGroupEditModel.AsTagGroup());
            }
            return(Json(new StatusMessageData(StatusMessageType.Success, "操作成功")));
            //return Json("success", JsonRequestBehavior.AllowGet);
        }
Пример #2
0
        public ActionResult _EditTagGroup(TagGroupEditModel tagGroupEditModel)
        {
            TagService             tagService = new TagService(tagGroupEditModel.TenantTypeId);
            IEnumerable <TagGroup> tagGroups  = tagService.GetGroups(tagGroupEditModel.TenantTypeId);

            if (tagGroups.Select(n => n.GroupName).Contains(tagGroupEditModel.GroupName))
            {
                return(Json("same", JsonRequestBehavior.AllowGet));
            }
            //添加
            if (tagGroupEditModel.GroupId == 0)
            {
                tagService.CreateGroup(tagGroupEditModel.AsTagGroup());
            }//编辑
            else
            {
                tagService.UpdateGroup(tagGroupEditModel.AsTagGroup());
            }


            return(Json("success", JsonRequestBehavior.AllowGet));
        }
        public ActionResult _EditTagGroup(long tagGroupId = 0, string tenantTypeId = "")
        {
            TagGroupEditModel tagGroupEditModel = null;

            //添加
            if (tagGroupId == 0)
            {
                tagGroupEditModel = new TagGroupEditModel();
                tagGroupEditModel.TenantTypeId = tenantTypeId;
            }//编辑
            else
            {
                TagService tagService = new TagService(string.Empty);
                tagGroupEditModel = tagService.GetGroup(tagGroupId).AsTagGroupEditModel();
            }

            //所属下拉框
            SelectList tenants = GetTenantSelectList(MultiTenantServiceKeys.Instance().Tag(), tagGroupEditModel.TenantTypeId, true);

            ViewData["tenants"] = tenants;

            return(View(tagGroupEditModel));
        }