Breaking the MVC cycle?

Topics: CAB & Smart Client Software Factory
Jun 24, 2005 at 4:17 PM
originally posted by: ptorrsmith

In this code, the controller is returning a customer reference directly. I thought the idea was that the controller should offer a "GetNextCustomerRequest" method, get the customer from wherever, place it into some state somewhere, which would raise a state changed event, which the listCustomers "view" has subscribed to, and either gets the customer reference in the event args, or queries the state/model object directly for the customer reference.

Or am I over complicating it or missing something fundamental?

private void btnNextCustomer_Click(object sender, EventArgs e)
{
CustomerReference customer = myController.GetNextCustomer();

if (customer == null)
{
MessageBox.Show("No more customers");
return;
}

listCustomers.Items.Add(customer);
}

Peter
Jun 24, 2005 at 7:47 PM
originally posted by: kzu_daniel_cazzulino

Why would you be breaking MVC? There's nothing wrong in the controller returning some data, although using the State would be fine too.