Exemplo n.º 1
0
        /// <summary>
        /// 编辑菜单
        /// </summary>
        /// <param name="Param"></param>
        /// <returns></returns>
        public string EditDiningMenu(RequestRepastMenu Param)
        {
            RepastMenu tree = Param.MapToEntity <RepastMenu>();

            if (Param.Id != Guid.Empty)
            {
                //修改
                if (Update <RepastMenu, RequestRepastMenu>(tree, Param))
                {
                    return(ServiceMessage.UPDATESUCCESS);
                }
                else
                {
                    return(ServiceMessage.UPDATEFAIL);
                }
            }
            else
            {
                //新增
                if (tree.HasChildrenNode) //true就是一级菜单
                {
                    tree.ParentId    = null;
                    tree.Level       = MenuEnum.LevelOne;
                    tree.MenuAddress = null;
                    tree.MenuId      = Guid.NewGuid();
                }
                else
                {
                    tree.Level  = MenuEnum.LevelTwo;
                    tree.MenuId = Guid.NewGuid();
                }
                if (Insert <RepastMenu>(tree))
                {
                    return(ServiceMessage.INSERTSUCCESS);
                }
                else
                {
                    return(ServiceMessage.INSERTFAIL);
                }
            }
        }
Exemplo n.º 2
0
 public ObjectResultEx EditDiningMenu(RequestRepastMenu Param)
 {
     return(ObjectResultEx.Instance(RepastService.EditDiningMenu(Param), 1, RetrunMessge.SUCCESS, HttpCode.Success));
 }