Пример #1
0
        public ActionResult Delete(IDList idlist)
        {
            Result result = new Result();

            result.message = "删除部门失败";


            if (idlist == null || idlist.Count == 0)
            {
                result.message = "您提交的数据为空,请重新选择!";
                return(Json(result));
            }
            GroupDTOList dtolist = new GroupDTOList();

            idlist.Where(f => !string.IsNullOrEmpty(f)).ToList().ForEach(s =>
            {
                Guid temp = Guid.Empty;
                s.Split(',').ToList().ForEach(g =>
                {
                    if (Guid.TryParse(g, out temp))
                    {
                        dtolist.Add(new GroupDTO()
                        {
                            ID = g
                        });;
                    }
                }
                                              );
            });
            using (ServiceProxy <IUserService> proxy = new ServiceProxy <IUserService>())
            {
                try
                {
                    proxy.Channel.DeleteGroup(dtolist);
                    result.success = true;
                    result.message = "删除成功";
                }
                catch (Exception ex)
                {
                    result.message = ex.Message;
                }
            }
            //Log.OperaInstance.SaveMessage(1, string.Format("操作:{0};结果:{1};信息:{2}", "删除分组(禁用)", true, ""));
            return(Json(result));
        }
Пример #2
0
        public ActionResult Delete(IDList idlist)
        {
            Result result = new Result();

            result.message = "删除角色失败";


            if (idlist == null || idlist.Count == 0)
            {
                result.message = "您提交的数据为空,请重新选择!";
                return(Json(result));
            }
            IDList ids = new IDList();

            idlist.Where(f => !string.IsNullOrEmpty(f)).ToList().ForEach(s =>
            {
                Guid temp = Guid.Empty;
                s.Split(',').ToList().ForEach(g =>
                {
                    if (Guid.TryParse(g, out temp))
                    {
                        ids.Add(g);
                    }
                }
                                              );
            });
            using (ServiceProxy <IUserService> proxy = new ServiceProxy <IUserService>())
            {
                try
                {
                    proxy.Channel.DeleteRole(ids);
                    result.success = true;
                    result.message = "删除成功";
                }
                catch (Exception ex)
                {
                    result.message = ex.Message;
                }
            }
            return(Json(result));
        }