Status messages to user

Status messages to user

Old forum URL: forums.lhotka.net/forums/t/2209.aspx


ballistic posted on Thursday, January 25, 2007

I'm trying to figure out how I can provide a status message to a user after an action has been completed successfully.

Working on a site where members will be able to add another member as a "buddy".  I would like to provide a status message, letting the member know that the other member was added to their buddy list.

I know that with the rules validation I can let the user know if an error occurred (buddy already exists in the list), but I am not sure how to do this when there are no errors.

The only way I tought of it, was to have the presentation layer call the factory method and check the return values.  However, I was hoping to move this away from the presentation layer and centralize it in the BOL.

Any suggestions?

- Andy

RockfordLhotka replied on Thursday, January 25, 2007

Separation of concerns mandates that the UI is responsible for displaying any status messages. That's not the job of the business layer.

But the UI should ask the business layer for any business information. In other words, the presentation layer should ask the object if all is good.

You should be able to do this immediatley following the Save() though, without the need to call the factory method to reload the object. Remember that Save() returns an updated instance of the object as a result of the save operation:

  _object = _object.Save();

If you use this approach, you can immediately ask _object about its status, thus enabling your UI to update the display accordingly.

Copyright (c) Marimer LLC