Esempio n. 1
0
        public SingleApiResponse Save(MenuSaveRequest req)
        {
            var menu = RepoBase.Instance.GetWhere <SS_MENU>(x => x.M_NAME == req.M_NAME_C).FirstOrDefault();

            if (menu != null)
            {
                return new SingleApiResponse()
                       {
                           ErrMsg = "此菜单已存在!", ErrCode = 1001
                       }
            }
            ;

            if (req.M_ID.HasValue)
            {
                return(MenuEdit(req));
            }
            return(MenuAdd(req));
        }
Esempio n. 2
0
        private SingleApiResponse MenuAdd(MenuSaveRequest req)
        {
            var menus      = RepoBase.Instance.GetWhere <SS_MENU>(x => x.M_PARENTID == req.M_PARENTID);
            var maxOrderId = menus.Max(x => x.M_ORDERID);
            var menu       = new SS_MENU()
            {
                M_PARENTID  = req.M_PARENTID,
                M_NAME      = req.M_NAME_C,
                M_NAME_C    = req.M_NAME_C,
                M_CODE      = req.M_CODE,
                M_PATH      = req.M_PATH,
                M_ICON      = req.M_ICON,
                M_ORDERID   = maxOrderId + 1,
                M_ORDERPATH = "",
                M_LINK      = ""
            };

            RepoBase.Instance.Add(menu);
            return(new SingleApiResponse());
        }
Esempio n. 3
0
        private SingleApiResponse MenuEdit(MenuSaveRequest req)
        {
            var menu = RepoBase.Instance.GetWhere <SS_MENU>(x => x.M_ID == req.M_ID.Value).FirstOrDefault();

            if (menu == null)
            {
                return new SingleApiResponse()
                       {
                           ErrMsg = "此菜单不存在!", ErrCode = 1001
                       }
            }
            ;
            menu.M_PARENTID = req.M_PARENTID;
            menu.M_NAME_C   = req.M_NAME_C;
            menu.M_CODE     = req.M_CODE;
            menu.M_PATH     = req.M_PATH;
            menu.M_ICON     = req.M_ICON;
            menu.M_DISABLED = req.M_DISABLED;
            RepoBase.Instance.Update(menu);
            return(new SingleApiResponse());
        }
Esempio n. 4
0
 public SingleApiResponse Save([FromBody] MenuSaveRequest req)
 {
     return(MenuBiz.Save(req));
 }