title: MVC Repository Pattern/Web Services SoC Question
body: <p>I am new to ASP.NET MVC and I am trying to implement best practices for a small-to-mid size application that uses a web service as its data source. The web service exposes the following methods to support the application: </p>
  
  <ol>
  <li>AuthenticateCustomer - returns the customer ID if valid email/password</li>
  <li>GetCustomer - returns a serialized object containing customer information</li>
  <li>Etc</li>
  </ol>
  
  <p>My question is, all of these services return Success (bool) and Message (string) values depending on the result of the operation. The message contains descriptive information if an error occurred. I'm not sure if the invocation of the web services belongs in the Repository layer, but I think it is important to be able to pass the Success and Message values up through the Repository -> Service -> Controller layers. The only way I can think of doing this is by either littering the Repository methods with out arguments:</p>
  
  <pre><code>public int AuthenticateCustomer(string Email, string Password, out bool Success, out bool Message);
  </code></pre>
  
  <p>or create some sort of wrapper that contains the intended return value (integer) and the Success and Message values. However, each web service method returns different values so a one-size-fits-all wrapper would not work. Also, these values would need to be passed up through the Service layer, and it just seems like validation of some sort is happening at the Repository level.</p>
  
  <p>Any thoughts on how to accomplish: 
  1. Separation of concerns (validation, data access via web service) while ...
  2. Having the ability to maintain the feedback received from the web service and pass it through all the way to the View?</p>
  
  <p>P.S. - Sorry for the terse question. It is a bit difficult to explain with any kind of brevity.</p>