Exemplo n.º 1
0
        private async void DeleteMenuItem(object sender, RoutedEventArgs e)
        {
            var successfulDeleteMenuItemRequest = await DeleteMenuItemRequest.SendDeleteMenuItemRequest(SelectedMenuItem._id);

            if (successfulDeleteMenuItemRequest)
            {
                await DeleteComps(SelectedMenuItem._id);

                ContentDialog responseAlert = new ContentDialog
                {
                    Title           = "Successful",
                    Content         = "Menu Item has been deleted successfully",
                    CloseButtonText = "Ok"
                };
                ContentDialogResult result = await responseAlert.ShowAsync();
            }
            else
            {
                ContentDialog responseAlert = new ContentDialog
                {
                    Title           = "Unsuccessful",
                    Content         = "Menu Item has not been deleted successfully",
                    CloseButtonText = "Ok"
                };
                ContentDialogResult result = await responseAlert.ShowAsync();
            }
            RefreshMenuItemList();
        }
Exemplo n.º 2
0
        public async Task <bool> HandleAsync(DeleteMenuItemRequest message, IOutputPort <ServiceResponse> outputPort)
        {
            var response = await _menuItemRepository.DeleteMenuItem(message.Id);

            outputPort.Handle(response.Success ? new ServiceResponse(response.Id, true)
                : new ServiceResponse(response.Errors.Select(e => e.Description)));
            return(response.Success);
        }
 /// <summary>
 /// Remove an item from the service menu
 /// </summary>
 /// <returns> DeleteMenuItemResponse object</returns>
 /// <param name="request"> DeleteMenuItemRequest object</param>
 /// <param name='jsonRpcCallId'>
 /// The json rpc call identifier. This is a string generated by the client, which can be used to correlate the response to the request. Max length is 256 characters. A JSON-RPC id must be generated on a per call invocation basis. The Rogerthat platform uses the id of the call to store the call result for a certain amount of time so that if something fails during the communication, the same call (having the same JSON-RPC id) can be resent to the Rogerthat service, allowing to fetch the result, without actually executing the call again. This avoids annoying problems such as duplicate delivery of messages.
 /// 
 /// You should use a different JSON-RPC id for every call you make.
 /// 
 /// In case of an intermittent failure such as a network connectivity problem, you can retry the same call using the same JSON-RPC id, without running the risk of duplicate execution of your call (e.g. duplicate message delivery).
 /// </param>
 public DeleteMenuItemResponse DeleteMenuItem(DeleteMenuItemRequest request, string jsonRpcCallId)
 {
     DeleteMenuItemResponse result = new DeleteMenuItemResponse();
     WireRequest(0, jsonRpcCallId, "system.delete_menu_item", (writer) =>
         {
             request.Write(writer, false);
         }, (reader) =>
         {
             result.Read(reader);
         }
     );
     return result;
 }
 /// <summary>
 /// Remove an item from the service menu
 /// </summary>
 /// <returns> DeleteMenuItemResponse object</returns>
 /// <param name="request"> DeleteMenuItemRequest object</param>
 public DeleteMenuItemResponse DeleteMenuItem(DeleteMenuItemRequest request)
 {
     return DeleteMenuItem(request, Guid.NewGuid().ToString());
 }