views:

39

answers:

0

I have to create an ASP.NET page that lists various types of customers in a grid. When a user selects to edit an item, a modal dialog should be displayed that allows the user to update the customer's properties. The dialog will display different fields and perform different validation depending on the type of customer being edited (i.e. PreferredCustomer, GovernmentCustomer, etc). Here's what I was thinking:

public interface ICustomerEditor
{
    event EventHandler<CustomEventArgs> Saved;
    event EventHandler Cancelled;
    void Render();
}


public class PreferredCustomerEditor : ICustomerEditor
{
  ...
}

public class GovernmentCustomerEditor : ICustomerEditor
{
    ...
}

My Presenter then can resolve the correct concrete implementation of ICustomerEditor (via IOC, a factory etc) and call its Render method. The Save and Cancel events can similarly be wired up generically to ICustomerEditor.

My question is how many Views/Presenters do I need here? One each for the aspx obviously. But do I need one for the modal dialog and/or each concrete ICustomerEditor?

This will be my first foray into MVP (if that's not already obvious), so I'm really hoping to get this right the first time.

Thanks for reading.