Base solution for your next web application
Open Closed

Success Message #1057


User avatar
0
maharatha created

The json returned by abp has place holder for Error Message, but I am not sure how to send a Success Message. There are instances where I would like to send a customized success message.

Is there a way to handle it ?

Thanks, Partha


8 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Where? From controller or from app service? You can create a custom object that contains success properties and return it.

  • User Avatar
    0
    maharatha created

    From App Service. yes I can create one , but I was thinking if it would be part of the framework that would be nice.

  • User Avatar
    0
    hikalkan created
    Support Team

    Hmmm.. nice idea. How we handle it in client side? Should show a UI notification or a messagebox?

  • User Avatar
    0
    maharatha created

    I would prefer to be a notification rather being a message box

  • User Avatar
    0
    hikalkan created
    Support Team

    OK, but how to set this success message? Because error message is automatically set independent from your return value. In that case, we should return a specific type instead of simply our return type. We should think an elegant way of it.

  • User Avatar
    0
    maharatha created

    If we can create a property like "Notification" or "UserMessage" if Success is true then Application layer can set the property and send it to the controller/ view to display it. Default message could be "The Transaction is successfully saved" so that I can always use this property to notify.

    Let me know your thoughts

  • User Avatar
    0
    hikalkan created
    Support Team

    Hmm.. That's fine. I also thought similar. If app service (and controllers) have some List<Notification>, then we can fill it and automatically show on UI. This can be useful. I created an issue for it: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1003">https://github.com/aspnetboilerplate/as ... ssues/1003</a> Thanks.

  • User Avatar
    0
    maharatha created

    Thank You for considering this. You are the best