title: Is passing a service reference to another service layer bad practice?
body: <p>I've got a C# MVC application that I break up in the following way:
  View -> Controller -> Service -> Repository</p>
  
  <p>I use the thin controller practice with each view having a unique view model that's returned from the relevant service.</p>
  
  <p>Quick Example:
  View: /NewAppointment/Step1</p>
  
  <p>Its controler would look like this:</p>
  
  <pre><code>public ActionResult Step1()
  {
    return View(_appointmentService.Step1GetModel() );
  }
  </code></pre>
  
  <p>And the appointment service layer would look like this:</p>
  
  <pre><code>public Step1Model Step1GetModel()
  {
    return new Step1Model();
  }
  </code></pre>
  
  <p>Thus I have several different service layers in use through out my application, each implementing a distinct interface. </p>
  
  <p>My question comes in when I need to have one service layer interact with another service layer. In this case, is it better practice to pass an interface reference to the service call, or should I let the controller handle collecting all the data and then pass the relevant results back to the service?</p>
  
  <p>Example:</p>
  
  <p>Say I want to populate my view model with the customer's information by default. The two ways I see of doing this are:</p>
  
  <p>Pass an customer interface reference to the appointment service, and then let the appointment service call the appropriate GetCustomer method in the customer service...</p>
  
  <p>In Code:</p>
  
  <pre><code> private ICustomerService _customerService;
   private IAppointmentService _appointmentService;
  
   public ActionResult Step1()
   {
     var viewModel = _appointmentService.Step1GetModel( _customerService );
     return View(viewModel);
   }
  </code></pre>
  
  <p>OR</p>
  
  <p>Let the controller handle the logic of getting the customer, then pass that result to the appointment service.</p>
  
  <p>In Code:</p>
  
  <pre><code>private ICustomerService _customerService;
  private IAppointmentService _appointmentService;
  
  public ActionResult Step1()
  {
      var customer = _customerService.GetCustomer();
      var viewModel = _appointmentService.Step1GetModel( customer );
      return View(viewModel);
  }
  </code></pre>
  
  <p>I'm torn as to which would be better practice. The first keeps the controller nice and thin, but creates an inter-service dependency between the appointment service and the customer service. The second puts more logic into the controller, but keeps the services totally independent.</p>
  
  <p>Anyone have thoughts as to which would be better practice?</p>
  
  <p>Thanks~</p>