Exemplo n.º 1
0
        public async Task <bool> HandleAsync(GetMenuItemRequest message, IOutputPort <GetMenuItemResponse> outputPort)
        {
            var response = await _menuItemRepository.GetMenuItem();

            outputPort.Handle(new GetMenuItemResponse(response, true, null));

            return(true);
        }
        public JsonResult GetMenuItem(System.Int32 id)
        {
            DataTableViewModel data1;

            GetMenuItemRequest request = new GetMenuItemRequest();

            request.MenuItemId = id;
            DetailMenuItem_MenuItemDetailView data = _menuItemService.GetMenuItem(request).MenuItem.ConvertToDetailMenuItem_MenuItemDetailView();

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetDetail(System.Int32 id)
        {
            MenuItemDetailView vm      = new MenuItemDetailView();
            GetMenuItemRequest request = new GetMenuItemRequest();

            request.MenuItemId = id;
            GetMenuItemResponse response = _menuItemService.GetMenuItem(request);

            if (response.MenuItemFound)
            {
                vm = response.MenuItem.ConvertToMenuItemDetailView();
            }

            return(Json(vm, JsonRequestBehavior.AllowGet));
        }
        public JsonResult Update(MenuItemDetailView vm)
        {
            GetMenuItemRequest request = new GetMenuItemRequest();

            request.MenuItemId = vm.MenuItemId;

            ModifyMenuItemRequest updateRequest = _menuItemService.GetMenuItem(request).MenuItem.ConvertToModifyMenuItemRequest();

            updateRequest.MenuItemId   = vm.MenuItemId;
            updateRequest.MenuItemName = vm.MenuItemName;
            updateRequest.ParentId     = vm.ParentId;
            updateRequest.MenuItemUrl  = vm.MenuItemUrl;

            ModifyMenuItemResponse response = _menuItemService.ModifyMenuItem(updateRequest);

            return(Json(response));
        }
Exemplo n.º 5
0
        public GetMenuItemResponse GetMenuItem(GetMenuItemRequest request)
        {
            GetMenuItemResponse response = new GetMenuItemResponse();

            MenuItem menuItem = _menuItemRepository
                                .FindBy(request.MenuItemId);

            if (menuItem != null)
            {
                response.MenuItemFound = true;
                response.MenuItem      = menuItem.ConvertToMenuItemView();
            }
            else
            {
                response.MenuItemFound = false;
            }


            return(response);
        }