Ejemplo n.º 1
0
        public async Task <ViewResultBase> Edit(SystemMenuButtonEditInput input)
        {
            var output = new SystemMenuButtonOutput();

            //如果为编辑
            if (!input.MenuButtonId.IsNullOrEmptyGuid())
            {
                var button = await _menuButtonLogic.GetByIdAsync(input.MenuButtonId);

                output = button.MapTo <SystemMenuButtonOutput>();
                //获取菜单信息
                var parentInfo = await _menuLogic.GetByIdAsync(output.MenuId);

                if (parentInfo != null)
                {
                    output.MenuName = parentInfo.Name;
                }
            }
            //新增
            else
            {
                if (!input.MenuId.IsNullOrEmptyGuid())
                {
                    var parentInfo = await _menuLogic.GetByIdAsync(input.MenuId);

                    output.MenuName = parentInfo.Name;
                    output.MenuId   = Guid.Parse(input.MenuId.ToString());
                }
            }
            return(View(output));
        }
Ejemplo n.º 2
0
        public async Task <JsonResult> GetById(IdInput input)
        {
            var button = await _menuButtonLogic.GetByIdAsync(input.Id);

            var output = button.MapTo <SystemMenuButtonOutput>();
            //获取菜单信息
            var parentInfo = await _menuLogic.GetByIdAsync(output.MenuId);

            if (parentInfo != null)
            {
                output.MenuName = parentInfo.Name;
            }
            return(Json(output));
        }